SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Select question
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bspama
Starting Member

8 Posts

Posted - 11/11/2002 :  12:18:59  Show Profile  Reply with Quote
Hi, just wanted to ask how i can select all documents in a table that have duplicate values or is Not Unique? Thanks!



Edited by - bspama on 11/11/2002 12:19:56

nr
SQLTeam MVY

United Kingdom
12543 Posts

Posted - 11/11/2002 :  12:21:42  Show Profile  Visit nr's Homepage  Reply with Quote
select fld
from tbl
group by fld
having count(*) > 1
?

==========================================
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.
Go to Top of Page

bspama
Starting Member

8 Posts

Posted - 11/11/2002 :  12:43:09  Show Profile  Reply with Quote
Thanks for the quick reply!

Go to Top of Page

bspama
Starting Member

8 Posts

Posted - 11/12/2002 :  08:28:35  Show Profile  Reply with Quote
NR, i have another question..

i have two fields, field1 which is an integer and field2 which is text, how do i select all documents in a table that have duplicate values or is not unique and sorted based on their corresponding field1 integer values?

thanks again.

quote:

select fld
from tbl
group by fld
having count(*) > 1
?

==========================================
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.



Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000