To make the row unique, try using the HAVING clause and GROUP By.
Refer to this video to learn HAVING clause in detail:
The following code will find all the users that have more than one payment per day with the same account number:
SELECT user_id ,COUNT(*) count
FROM PAYMENT
GROUP BY account,user_id ,date
Having COUNT(*) > 1
Note: If you want to include only those users who have a distinct ZIP, then you can get the distinct set first. Now, you can perform HAVING/GROUP BY like this:
Refer to this video if you want to learn GROUP BY clause in detail:
SELECT user_id,account_no , date,COUNT(*)
FROM(SELECT DISTINCT
user_id,
account_no ,
zip,
date
FROM
payment
)
payment
GROUP BY user_id,account_no , date
HAVING COUNT(*) > 1
To master SQL statements, queries and become proficient in SQL queries, enroll in an industry-recognized SQL Online Course.