Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Simplify SQL select
Message
From
28/05/1998 15:21:37
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00102530
Message ID:
00102863
Views:
29
>>Can any one recomend changes to simplify this SQL select?
>>
>>
>>select lim_val.code, lim_txt.lim_num, lim_txt.lim_text, ;
>>	lim_txt.lim_suffix ;
>>  from lim_val, lim_txt ;
>>  where lim_txt.lim_num = lim_val.lim_num ;
>>	and lim_txt.lang_code = m.lang_activ ;
>>union ;
>>select lim_val.code, lim_def.lim_num, lim_def.lim_text, ;
>>	lim_def.lim_suffix ;
>>  from lim_val, lim_def ;
>>  where lim_def.lim_num = lim_val.lim_num ;
>>	and lim_def.lang_code = m.lang_activ ;
>>	and lim_val.code + str(lim_val.lim_num) not in ;
>>	(select lim_txt.code + str(lim_txt.lim_num) ;
>>	  from lim_val, lim_txt ;
>>	  where lim_txt.code = lim_val.code ;
>>		and lim_txt.lim_num = lim_val.lim_num ;
>>		and lim_txt.lang_code = m.lang_activ)
>>
>>
>
>Eeek. Could you explain, in plain english, the business nature of the select? That would help me.



Multilingual database describing analog points and their associated limits in a Programmable Logic Controller (PLC). The database is used to configure and operate the Man-Machine Interface (MMI).

Tables:

Analog - Analog point table, key: Anlg_Code, filter: none, children: Anlg_Txt, Lim_Val
Anlg_Txt - Analog point table, key: Anlg_Code, filter: Lang_Code, children: none
note: Code is that same as Anlg_Code
Lim_Val - Limit Values table, key: Code+Lim_Num, filter: none, children: Lim_Def, Lim_Txt
Lim_Def - Limit Default Text table, key: Lim_Num, filter: Lang_Code, children: none
Lim_Txt - Limit Text table, key: Code+Lim_Num, filter: Lang_Code, children: none

For each Analog row there is an Anlg_Txt row for each language. These tables are left out of the query at this time. If an Limit Value is entered for an Analog Point, there is a row in Lim_Val with that Lim_Num. There are X Lim_Def rows, with Lim_Num from 1 to X for each language. There may be custom text for a particular Analog Point's Limit. If there is a row in Lim_Txt that matches the Analog Point and the Limit Number, the fields in Lim_Txt take precedence over the defaults.
Previous
Reply
Map
View

Click here to load this message in the networking platform