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 |
|
lane0618
Posting Yak Master
134 Posts |
Posted - 2002-05-22 : 10:52:12
|
| I have a view in which I am trying to select a distinct list. When I try to use the distinct command on the following table, I end up with all 5 rows because there are different description for the same item. ITEM Descriptiona desc1a desc2a desc3b desc4b desc5I don't care about losing description 2,3 and 5. I want my view to return this:ITEM Descriptiona desc1b desc4How is this possible?Thanks,Lane |
|
|
YellowBug
Aged Yak Warrior
616 Posts |
Posted - 2002-05-22 : 11:00:15
|
| You can try something like this:select ITEM, max(DESCRIPTION)FROM myTableGROUP BY ITEM |
 |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-05-22 : 11:00:25
|
select item, min(descriptionfrom <tablename>group by item <O> |
 |
|
|
lane0618
Posting Yak Master
134 Posts |
Posted - 2002-05-22 : 12:43:28
|
| Perfect!Thanks!Lane |
 |
|
|
|
|
|