dbTalk Databases Forums  

distinct records

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss distinct records in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gato
 
Posts: n/a

Default distinct records - 06-07-2004 , 11:33 AM






My table looks like this:

1 A B 6 C 8
2 A B 6 C 8
3 A B 6 C 9
4 A B 7 C 9
5 A B 7 C 9

I want to get just the first record (1 A B 6 C 8) based on
the second colunm.

Thanks

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: distinct records - 06-07-2004 , 11:51 AM






Something like


SELECT <list>
FROM TABLE OuterTable
WHERE Col1 = (SELECT MIN(col1) FROM TABLE InnerTable WHERE InnerTable.Col2 =
OuterTable.Col2)



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"gato" <anonymous (AT) discussions (DOT) microsoft.com> wrote

Quote:
My table looks like this:

1 A B 6 C 8
2 A B 6 C 8
3 A B 6 C 9
4 A B 7 C 9
5 A B 7 C 9

I want to get just the first record (1 A B 6 C 8) based on
the second colunm.

Thanks



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.