pdkt.net
当前位置:首页 >> mysql DElEtE中whErE后能套用sElECt么 >>

mysql DElEtE中whErE后能套用sElECt么

delete from table where id in (select user_id from table2)

一使用SELECT子句进行多表查询 SELECT 字段名 FROM 表1,表2 … WHERE 表1.字段 = 表2.字段 AND 其它查询条件 SELECT a.id,a.name,a.address,a.date,b.math,b.english,b.chinese FROM tb_demo065_tel AS b,tb_demo065 AS a WHERE a.id=b.id 注:在...

不能先select出同一表中的某些值,再update这个表(在同一语句中) 解决方案 --1.把需要删除的数据放到另外的一张表里create table table_test as select oneName from one group by OneName,OneAge,oneSex,oneAddress having count(oneName) > 1;...

mysql 删除可以用子查询。 mysql删除子查询中的记录语句: Sql代码 delete from t_5star where locationid in ( select e.locationid from ( select a.* from t_5star as a , t_als_data as b where a.term = b.term ) e ) 关键是子查询中的语句...

DELETE FROMheartbeat2_tb WHEREid not in (SELECTmin(id)FROMheartbeat2_tbGROUP BY(devname+psamid+roadid)HAVINGcount(*) > 1)

select *,aaa as a from table1 where id = 1; 我试过了好使。不要把*放到查询字段的最后,否则不好使。 还有啊,既然语句都写出来了,就先在mysql中执行一下啊,不就知道好不好用了吗? 希望可以帮到你

mysql中的where如果有多个条件的话用and连接。 如,student表中有如下数据: 现在要查,sex为男,age为20的那些数据,可用如下语句: select * from student where sex='男' and age=20; 结果截图:

你的sql写错了,注意你的 and 后面不是一个“判断”,没有 =,也没有in相关的。 根据你的意识,我推断应该这样写 SELECT * FROM ecm_goods a WHERE a.goods_id in ( select b.goods_id from ecm_category_goods b where b.cate_id=1338 )

delete from A where ID in (1,2,3) and ID not in(select ID from B) 或 delete from A where not exists (select ID from B where ID=A.ID) and ID in (1,2,3)

可以用别名,只是你写法写错了。 DELETE t1 FROM test AS t1 WHERE ..... 参见 http://dev.mysql.com/doc/refman/5.7/en/delete.html

网站首页 | 网站地图
All rights reserved Powered by www.pdkt.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com