如何从mysql表中删除具有相同列值的特定行? [英] How to delete a certain row from mysql table with same column values?
本文介绍了如何从mysql表中删除具有相同列值的特定行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在MySQL中的查询有问题.我的表格有4列,看起来像这样:
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
和id_product
是来自不同表的外键.
id_users
and id_product
are foreign keys from different tables.
我要删除的只是一行:
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?
推荐答案
将limit
添加到
查看全文