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.

 All Forums
 Other Forums
 Other Topics
 How do I get SQL to return all columns when performing a distinct on one column?

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-16 : 18:57:11
Karen writes "Each record in my table contains a code number (fld_1). I need a result set containing the first record to contain each code number, and I need all columns returned. No summing is required. Also, there is no date field to use with a max(date).


Here's a sample of the table data:

fld_1 fld_2 fld_3
0002 0000 HOME
0002 0001 EAST
0002 0002 SOUTHEAST
0002 0003 WEST
0002 0004 UPS
0002 0005 SEARS
0003 0000 HOME
0003 0001 NEW ENGLAND
0003 0002 NEW YORK
0003 0003 MID ATLANTIC
0008 0000 NO AREA
0008 0002 BUSINESS CLAIMS OTUS TEST


And here's what I want returned:

fld_1 fld_2 fld_3
0002 0000 HOME
0003 0000 HOME
0008 0000 NO AREA



I'm using Sybase 11 on a UNIX box.

Thanks in advance for any help!

"
   

- Advertisement -