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 |
PeteLeHoq
Starting Member
37 Posts |
Posted - 2011-03-24 : 09:59:22
|
What SQL statement do you use to select distinct on one col and return two other ones. E.gTeamNum | Col1 | Col21 | Oranges | Lemons1 | Oranges | Apples2 | Pears | Grapes2 | Pears | Bananas2 | Pears | LemonsSo the data returned would be:Oranges | LemonsPears | GrapesThe distinct needs to be applied to the "TeamNum" col. I'm on a Access database.Thanks.edit: moved to proper forum |
|
SMerrill
Posting Yak Master
206 Posts |
Posted - 2011-04-29 : 19:26:46
|
[code]SELECT First(Fruit.Col1) AS Fruit1, First(Fruit.Col2) AS Fruit2FROM FruitGROUP BY Fruit.TeamNum;[/code]~ Shaun MerrillSeattle area |
|
|
|
|
|