Mysql – How to delete a certain row from thesql table with same column values

delete-rowMySQL

I have a problem with my queries in MySQL. My table has 4 columns and it looks something like this:

id_users    id_product    quantity    date
 1              2              1       2013
 1              2              1       2013
 2              2              1       2013
 1              3              1       2013

id_users and id_product are foreign keys from different tables.

What I want is to delete just one row:

1     2     1    2013

Which appears twice, so I just want to delete it.

I've tried this query:

delete from orders where id_users = 1 and id_product = 2

But it will delete both of them (since they are duplicated). Any hints on solving this problem?

Best Answer

Add a limit to the delete query

delete from orders 
where id_users = 1 and id_product = 2
limit 1