mysql删除命令 [英] mysql delete command
本文介绍了mysql删除命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
mysql delete命令在单个表中没有该表的主键.我插入了具有相同ID,两个记录具有相同名称的记录.我需要从单个表中删除1条记录
编号名称
1个测试
1个测试
我需要删除一条记录
mysql delete command in single table no primary key for the table. i have inserted records for same id, same name for two records. i need to delete 1 record from the single table
id name
1 test
1 test
i need to delete one record
推荐答案
像这样尝试
try like this
DELETE FROM Sample WHERE id=1 LIMIT 1;
或
or
DELETE FROM Sample WHERE id IN (SELECT id FROM Sample GROUP BY id HAVING COUNT(*) > 1) LIMIT 1
您好,
使用rownum删除相同行中的任何一个值.
问候
Hi,
delete any one value in identical rows by using rownum.
Regards
delete from <table name=""> where <primarykey> = <string></string></primarykey></table>
这篇关于mysql删除命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文