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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2006-04-12 : 09:15:28
|
| Jake writes "I'm looking for something equivalent to this: select * from t~able group by city, stateThis query won't work because all fields in the 'select' have to be in the 'group by', but I need something that allows me to select all fields while ensuring unique city+state (ie- only one record with city="Park City" state="UT").It seems like a pretty common type of query, but I haven't been able to find anything that do this. Any thoughts on how to do this?" |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-04-12 : 09:19:21
|
| Only One record per City / State Combination ?So if there r multiple records, with same City & State, what do u want to see ? Just any one randomly ?Please Post some sample data and expected results Srinika |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-12 : 09:39:33
|
| Do you want one row for every city and state?MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|