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 |
|
wleonard
Starting Member
30 Posts |
Posted - 2011-02-24 : 14:24:09
|
| I am trying to select a specific record from an executed query. My logic would go something like this:SELECT blah blah from (query) where blah blah = blah blahBut this logic does not execute properly. Here is my query:SELECT DISTINCT b.uhc_description, c.uhc_description FROM tblUserhierarchychoice a, tblUserhierarchychoice b, tblUserhierarchychoice c where c.uhl_level = 'B' and a.uhl_level = 'A' andb.uhl_level = 'M' and a.udh_parent_level = b.uhl_level and a.uhc_parent_code = b.uhc_codeand c.udh_parent_level = a.uhl_level and c.uhc_parent_code = a.uhc_codeorder by b.uhc_descriptionPlease give some feedback when possible.Will Leonard |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-02-24 : 14:55:59
|
| Here's a different version of the same:SELECT DISTINCT b.uhc_description, c.uhc_descriptionFROM tblUserhierarchychoice a inner join tblUserhierarchychoice b on a.udh_parent_level = b.uhl_level and a.uhc_parent_code = b.uhc_codeinner join tblUserhierarchychoice c on c.udh_parent_level = a.uhl_level and c.uhc_parent_code = a.uhc_codewhere c.uhl_level = 'B' and a.uhl_level = 'A' and b.uhl_level = 'M' order by b.uhc_description |
 |
|
|
|
|
|