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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another SQL help

Status
Not open for further replies.

soldierdackel

Programmer
Joined
Jun 8, 2004
Messages
7
Location
DK
Hi there,

I've got a table PO_HEADER with a field PO_NO. Normally the PO_NO should be unique but in some cases it's not. How do I find those rows where it is not unique?

I started like this:

select distinct PO_NO
from PO_HEADER
where ..... and then I stopped!

Anyone able to help? It's an Oracle 9i database.

Cheers
 
Don't bother to reply. I found a solution:

select distinct po_no
from po_header
group by po_no
having count(po_no) > 1

Cheers
 
you don't need the DISTINCT

groups are distinct by definition

rudy
SQL Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top