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 |
|
oepirobo
Starting Member
36 Posts |
Posted - 2003-03-06 : 15:04:45
|
| I have this table:FirstName LastName City State------------------------------------------Al Bundy Chicago IllPeg Bundy Gary IndJohnathan Davis LA CalDel Davis Omaha NebGeena Davis Seattle WasI need to see all fields but only one row per last name, so I would only see:FirstName LastName City State------------------------------------------Al Bundy Chicago IllJohnathan Davis LA CalHow do I do this? |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-03-06 : 17:39:52
|
| What is the PK?If it's FirstName, LastNameselect t1.*from tbl t1where t1.FirstName = (select min(t2.FirstName) from tbl t2 where t1.LastName = t2.LastName)But you probably have an id or guid so use that for the subquery join.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|
|