If I have the following table
T1 _______ id userID productID
How do I find records, where userID is used more then once?
What exactly do you want to select?
well, I actually need to write a script that will find multiple records where the same user has the same product and delete the duplicate.
id=2 userID=22 productID=5 id=65 userID=22 productID=5
id=2 userID=22
id=65 userID=22 productID=5
hmm... would a simpler solution be to create another table where (userID, productID) is unique, and then just insert from the existing table?
It is pretty simple to get the userId and productId.
select userid, productid from table having count(id) > 1 group by userid, productid
Great. It worked. I just had to place GROUP BY before HAVING COUNT.