delete 后面是不是不能跟 in 语句?
delete from gb_main a where a.gb_read = 0 and a.gb_reid not in (select b.gb_id from gb_main b)
执行的话,提示:
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where a.gb_read = 0 and a.gb_reid not in (select b.gb_id from gb_main b)' at line 1
(0 ms taken)
是不是delete 后面不能跳in?
select * from gb_main a where a.gb_read = 0 and a.gb_reid not in (select b.gb_id from gb_main b) 这一句是可以执行的
这些数据全在一张表里面
问题点数:20、回复次数:7Top
1 楼yueliangdao0608((深圳PHPER.MSN:yueliangdao0608@gmail.com)回复于 2006-12-03 07:56:15 得分 5
delete from gb_main where gb_read = 0 and gb_reid not in (select gb_id from gb_main);
Top
2 楼dyh86555(孤魂)回复于 2006-12-03 08:48:40 得分 5
可以含in
delete from gb_main a where (a.gb_read = 0) and (a.gb_reid not in (select b.gb_id from gb_main b))
Top
3 楼mschen(Co-ok)回复于 2006-12-03 09:42:20 得分 10
如果delete的时候使用别名的话,那么delete后边必须加上别名.如下:
delete a from gb_main a where a.gb_read = 0 and a.gb_reid not in (select b.gb_id from gb_main b)Top
4 楼xiaxin(Java)回复于 2006-12-03 15:04:04 得分 0
执行不了啊!
不管是在mysql 的命令提示符环境下,还是在SQLyog Enterprise 里面,都执行不了!将前面的delete from 改成select * from 就可以执行!
提示:
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where (a.gb_read = 0) and (a.gb_reid not in (select b.gb_id from gb' at line 1
(0 ms taken)
Top
5 楼xiaxin(Java)回复于 2006-12-03 19:59:23 得分 0
光理论通得过没用啊,得实践通得过!Top
6 楼CaiNiaoWuZui()回复于 2006-12-03 20:07:05 得分 0
支持2楼Top
7 楼xiaxin(Java)回复于 2006-12-03 21:15:47 得分 0
这些语句不知道你们有没有运行过Top




