56,677
社区成员
发帖
与我相关
我的任务
分享
select book_id,book_name
from 表1
where is_exist=1
and exists (select 1 from 表2 where book_id=表1.book_id)
and not exists (select 1 from 表2 where book_id=表1.book_id and user='tom')
select 表1.book_id,表1.book_name,b.level
from 表1,(select book_id,level from 表2 group by book_id,level having count(*)>=3) b
where 表1.book_id=b.book_id