Shawn
Shawn

Reputation: 7365

Oracle SQL Query Question

I have the following table setup in an oracle database:

Column Pk_foo1
Column Pk_foo2
Column Pk_foo3

How do I select the rows that are not unique if it were the case that Pk_foo1 and Pk_foo2 were the only primary keys.

An example of a select query would be appreciated. Thanks!

Upvotes: 1

Views: 137

Answers (1)

Tony
Tony

Reputation: 10327

SELECT Pk_foo1, Pk_foo2
FROM Table
GROUP BY Pk_foo1, Pk_foo2
HAVING COUNT(*) > 1

Upvotes: 4

Related Questions