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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Unique results returned based on ID

Author  Topic 

Yasir
Starting Member

1 Post

Posted - 2004-05-12 : 10:01:43
Hi,

Hope someone could help me.

I have thousands of records which consists of 20 columns in a table, inside this table
there are many records that have the same ID. I would like to return the results of the first raw based on the uniqueness of the ID. i.e.

table jobs
PSD_ID FNAME SNAME COUNTRY etc.....
SHDS111 Mike Jones UK
SHDS222 Samantha Evans America
SHDS888 Lee Wong China
SHDS111 Julie Stevens UK
SHDS999 Ali Mohamad Saudai Arabia
SHDS222 Richard Mccarthy America
SHDS111 Edward Jones UK


The results I would like to get back are:
table jobs
PSD_ID FNAME SNAME COUNTRY etc.....
SHDS111 Mike Jones UK
SHDS222 Samantha Evans America
SHDS888 Lee Wong China
SHDS999 Ali Mohamad Saudai Arabia


Hope you can help

Regards.

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-05-12 : 10:17:44
How are you defining FIRST ? what is the key to this table (is there one?) why are you retuning Mike Jones instead of Edward Jones, based on the sample data you have provided. remember, SQL Server has no notion of a row order-- everything is done based on the VALUES in the DATA --not how it was physically inserted or how it is physically stored.

- Jeff
Go to Top of Page
   

- Advertisement -