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 |
JoeMa
Starting Member
5 Posts |
Posted - 2008-12-16 : 05:07:53
|
Hi there,i don't see the forest because there are so many trees.Maybe you can help me out?t1 (with unique ref_id)=======ref_idref_labelt2 (ref_id occurrs 0 .. n times)=======ref_idnameThe result should be an alphabetical sorted list of t1.ref_label with the t2.name of the first occurrence of t1.ref_id in t2.ref_id :ref_label namelabel a name xlabel b name ylabel c name x Can someone give me hint at least?Thx in advance,regardsjoema |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-16 : 05:17:22
|
[code]SELECT t1.ref_label,min(t2.name) as nameFROM t1INNER JOIN t2ON t1.ref_id=t2.ref_id[/code] |
|
|
JoeMa
Starting Member
5 Posts |
Posted - 2008-12-16 : 05:48:48
|
I have to admit that it wasn't a distinct problem BTW, i have had to add GROUP BY t1.ref_label to let it work.Nevertheless thank you very much |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-16 : 07:03:05
|
OOps...sorry i missed thatout during posting...glad that you spotted it and sorted it out |
|
|
|
|
|