Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nvakeel
Yak Posting Veteran
52 Posts |
Posted - 2008-02-13 : 10:42:12
|
| Tbl1----Valve1 Valve2------ --------Buttefly......KeystoneKite...........MouseEno............PadTbl2----Priority Valve------ ------1............Butterfly2............Kite3............EnoTbl3-----Group1 Group2 Group3------ ------ ------All..........Eno.......AllButterfly......All......KiteEno............None......AllNow my logic should returnvalve1 should fall in Group1 because group 1 holds All,Butterfly, enoand All can accomodate any of the attributes of the valve.If in Group1 All,Eno,None then valve1 should fall in group3. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-13 : 10:49:40
|
How do you want your result presented? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
nvakeel
Yak Posting Veteran
52 Posts |
Posted - 2008-02-13 : 11:19:52
|
| valve1--groupname--priority |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-13 : 11:52:12
|
How do Tbl2 with priorities come into the picture? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-13 : 11:53:14
|
[code]-- Prepare sample dataDECLARE @Tbl1 TABLE (Valve1 VARCHAR(20), Valve2 VARCHAR(20))INSERT @Tbl1SELECT 'Butterfly', 'Keystone' UNION ALLSELECT 'Kite', 'Mouse' UNION ALLSELECT 'Eno', 'Pad'DECLARE @Tbl2 TABLE (Priority TINYINT, Valve VARCHAR(20))INSERT @Tbl2SELECT 1, 'Butterfly' UNION ALLSELECT 2, 'Kite' UNION ALLSELECT 3, 'Eno'DECLARE @Tbl3 TABLE (Group1 VARCHAR(20), Group2 VARCHAR(20), Group3 VARCHAR(20))INSERT @Tbl3SELECT 'All', 'Eno', 'All' UNION ALLSELECT 'Butterfly', 'All', 'Kite' UNION ALLSELECT 'Eno', 'None', 'All'[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-02-13 : 12:25:51
|
How do you relate the three tables to each other? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
nvakeel
Yak Posting Veteran
52 Posts |
Posted - 2008-02-13 : 12:57:21
|
| i think this is a bad example.. let me come up with good one.Thanks for the patience. |
 |
|
|
|
|
|
|
|