I've 2 tables namely: 1. downloadedtickets 2. redeemedtickets
Each table has the attribute "ticketid".
I want to find people who downloaded their ticket but did not redeem them - essentially, find non-duplicated (unique) ticketids.
My Query (PHP) is as follows:
$sql = "
SELECT ticketid
FROM (
SELECT ticketid
FROM downloadedtickets
UNION ALL
SELECT ticketid
FROM redeemedtickets
)
GROUP BY ticketid
HAVING COUNT(*) = 1";
I am not getting any output from this.