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
 Site Related Forums
 The Yak Corral
 Need query to show duplicates only-please help

Author  Topic 

utleya
Starting Member

3 Posts

Posted - 2002-08-28 : 14:25:26


Hi all, I have a table that I need to query
to show only duplicate DocNums and an associated field
called DocType.

Example of desired output:

DocNum DocType
-------- ----------
92-155 TOP
92-155 ROP
92-155 HOR
02-999 TOP
02-999 ROP

The following was suggested on another site, but will not
work with SQL Server:


SELECT DocNum, DocType
FROM leDocs
WHERE (docnum, doctype) IN
(SELECT docnum, doctype
FROM ledocs
GROUP BY docnum, doctype
HAVING COUNT(*) > 1)
ORDER BY docnum, doctype

Any help will be appreciated, thanks, Andy


AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-08-28 : 14:37:20
Andy,

Unlike some other boards, we at SQLTeam prefer you to just post your question in one category because the top answer people review all categories and it will get seen just as quickly regardless of which category it's in.

All answers should be posted to this thread: [url]http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=19267[/url]

Go to Top of Page
   

- Advertisement -