有一表,表结构如下:
id name
1 aaa
2 bb
3 aaa
4 cc
怎样用一条SQL语句,任意删除一条name是aaa的记录(只能删除一条)
id name
1 aaa
2 bb
3 aaa
4 cc
怎样用一条SQL语句,任意删除一条name是aaa的记录(只能删除一条)
解决方案 »
- 关于ArrayList集合放对方,然后怎么测算出其内存大小呢
- JAVA的小问题
- 请教个问题
- 请教大虾JAVA中能够从远程获取操作系统信息,硬件信息和安装软件信息吗?
- 一个微妙得问题(有关命令行参数和乘法符号)
- 怎么用java来解一个winzip8.0压缩格式的压缩包?
- 英文系统中安装Jbuilder2005和金山词霸有冲突!
- Exception in thread "main" java.lang.NoSuchMethodError: main
- 谁能告诉我jbuilder5的注册码,邮给我,感激不尽!
- java jxl读取带空格路径的文件问题
- double类型的问题
- html的空格问题,有经验的给说说
DELETE FROM<表名> [WHERE<删除条件>]
WHERE 是注明要删除哪一行,如果不注明条件就会全部删掉了
还有用DELETE 不能删除某一列,要删就是删一行或多行
delete from table where id =(select top 1 id from table where name='aaa')
是top 1还是first 1呢?哪个对?
delete from table where id =(select id from table where name='aaa' limit 1)
测试下。
例如:
取出前一条
select * from table where rownum<=1
取出前两条
select * from table where rownum<=2
select * from table where id=(select * from table where name='aaa' and rownum<=1)呢?
delete from table_name where field_name='aaa' limit 1;oracle:(不是很确定)
delete from table_name
where id = (select id from (select t.id from table_name t where t.field_name='aaa') where rownum = 1);
mysql应该limit