'SELECT userid FROM hy_user WHERE isviewflag != 1 ) LIMIT 0, 30'多了个")"
谢谢 jetxt(擦肩而过) select userid from hy_user where isviewflag!=1 SELECT * FROM `hy_info` WHERE userid not in(8265,8266,8264)我是把上面这两个运行正常的语句合到一起才报的错: SELECT * FROM `hy_info` WHERE userid not in(select userid from hy_user where isviewflag!=1)不知是什么原因,郁闷中
你的Mysql不支持嵌套查询,升级到4.0之后
select userid from hy_user where isviewflag!=1 SELECT * FROM `hy_info` WHERE userid not in(8265,8266,8264) 关联查询不行吗? select a.* from hy_info a ,hy_user b where a.userid!=b.userid and b.isviewflag!=1
你试试这样,看行不行啊!!!!! select userid from hy_user where isviewflag!=1 SELECT * FROM `hy_info` WHERE userid not in(8265,8266,8264)我上面这语句结合成以下的: SELECT * FROM `hy_info` WHERE userid not in(select 8265,8266,8264 from hy_user where isviewflag!=1)
已解决,谢谢各位了 是网站主机的Mysql不支持嵌套查询,没法升级,关联查询可行,不过每次都要查一遍,效率不高。我把查询结果放到一个变量里,然后调出来直接用,还挺方便。 idstr="select userid from hy_user where isviewflag!=1"SELECT * FROM `hy_info` WHERE userid not in(idstr)再次感谢,散分!
SELECT * FROM `hy_info` WHERE userid not in(8265,8266,8264)我是把上面这两个运行正常的语句合到一起才报的错:
SELECT * FROM `hy_info` WHERE userid not in(select userid from hy_user where isviewflag!=1)不知是什么原因,郁闷中
SELECT * FROM `hy_info` WHERE userid not in(8265,8266,8264)
关联查询不行吗?
select a.* from hy_info a ,hy_user b where a.userid!=b.userid and b.isviewflag!=1
select userid from hy_user where isviewflag!=1
SELECT * FROM `hy_info` WHERE userid not in(8265,8266,8264)我上面这语句结合成以下的:
SELECT * FROM `hy_info` WHERE userid not in(select 8265,8266,8264 from hy_user where isviewflag!=1)
是网站主机的Mysql不支持嵌套查询,没法升级,关联查询可行,不过每次都要查一遍,效率不高。我把查询结果放到一个变量里,然后调出来直接用,还挺方便。
idstr="select userid from hy_user where isviewflag!=1"SELECT * FROM `hy_info` WHERE userid not in(idstr)再次感谢,散分!