mysql查询的问题,A表里有所有的图片id号,B表里有一部分图片的id号,想查询B表里面没有的其他图片

来源:百度知道 编辑:UC知道 时间:2024/06/05 12:14:36
$query="select img_id,img_title,userid from image where img_id not in(select picid from view_grouppic)

我试过not in 了,不行
A表就是image ,B表就是view_grouppic,picid 是view_grouppic表里的图片id号

我的mysql版本是 3.23.56-log 的,不支持子查询吧

用'left join 后出这个错误
You have an error in your SQL syntax near 'left join view_grouppic b on a.img_id = b.picid where b.picid is null' at line 2

在这种低版本mysql版本是 3.23.56-log 的情况下,大家有没有好的方法,改怎么实现呢

这个问题就需要left join 函数上场了,呵呵.

select table a
left join
table b
on a.img_id = b.img_id
where b.img_id is null

估计你的版本太低了,不支持。呵呵。

not in