之前也遇到过类似的问题,就是in关键字指定的范围没有数据,会出错######改用exists呢######不行######用join 链接查询过滤一下算了######我是这么做了,但是现在我就想知道,这种情况有解决办法吗######
引用来自“抓瓦工人”的评论用join 链接查询过滤一下算了
mysql IN不起来
它是软的######??????######
你那会报什么错? 这个SQL不应该报错. 只会返回返回 empty set 而已. 我测试这个SQL是没问题的:
select * from test where id in (select id from test where id = -1);
######不会报错. mysql v5.7.10######
引用来自“hao5ang”的评论
你那会报什么错? 这个SQL不应该报错. 只会返回返回 empty set 而已. 我测试这个SQL是没问题的:
select * from test where id in (select id from test where id = -1);select
eduresource.*
from
eduresource
where
eduresource.resourcecode in
(
select downupload.resourcecode form downupload where
downupload.usercode='0' and downupload.opcode=0
and downupload.delete_flg=0
)
[Err] 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 'downupload where
downupload.usercode='0' and downupload.opcode=0
' at line 8
######你SQL是这么写的? 括号里面 from 写成了 form吧.