34,838
社区成员




--统计某个用户报名多少个自驾游?
select count(*) from 报名 where 用户id='用户id'
--是否查留言
--列出某个用户在“南京一日游”这个自驾游上浏览内容和时间
select * from 留言 where 用户id='用户id'
and 自驾游id in (select 自驾游id from 自驾游信息表 where 自驾游主题='南京一日游')
--列出报名“南京一日游”自驾游而没有在这个自驾游上浏览用户列表
select a.* from 用户表 a,报名 b,自驾游信息表 c
where a.用户id=b.用户 and b.自驾游id=c.自驾游id and c.自驾游主题='南京一日游'
and not exists(select * from 留言 where 自驾游id=b.自驾游id and 用户id=a.用户id)