Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Statement help... 1

Status
Not open for further replies.

mistrymk

Programmer
Jun 21, 2001
2
GB
Hi, I have a table and I want to identify duplicate rows of account numbers and sequence numbers. The closest I can think of is below and doesn't work.
Select ACCOUNT_NO,SQN_NO
from ACCOUNT_TABLE
WHERE (ACCOUNT_NO,SQN_NO) NOT IN
(select distinct ACCOUNT_NO,SQN_NO
from ACCOUNT_TABLE)

As always, any help is appreciated.
 
If you want select duplicate rows on (ACCOUNT_NO, SQN_NO), you could use this request :
Code:
select  *
from    ACCOUNT_TABLE
where   (ACCOUNT_NO, SQN_NO) in           
        (   select  ACCOUNT_NO
                ,   SQN_NO
            from    ACCOUNT_TABLE
            group by ACCOUNT_NO
                ,   SQN_NO
            having  count(*) > 1
        )
;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top