I have a table with rows in the following format:
transactionDate, purchaseOrderId
8/8/2012, 55
8/9/2012, 55
8/8/2012, 88
8/9/2012, 55
8/10/2012, 77
I want to find all rows where the transactionDate and purchaseOrderId are both exact. So the following two rows are duplicates:
8/9/2012, 55
8/9/2012, 55
I tried using the following query:
SELECT
transactionDate, purchaseOrderId
FROM
purchases
GROUP BY
transactionDate, purchaseOrderId
HAVING COUNT(*) > 1;
However it returned the Aug 8th result in addition to the Aug 9th result. How do I make it only return fields where both columns are duplicated (instead of returning all transactions for each date)?
Thanks.