» 救命啊,求sql高手帮忙。。。
select count(*) new_user from (
select DISTINCT b.uin from (
select cover_id from table1) a
where a.type=2 and a.area=8) a
join
(select cid,uin from table3
where imp_date>=20130311 and imp_date<=20130317) b
on (a.cover_id=b.cid)
) a
left outer join
(select DISTINCT uin table3
where imp_date>=20120311 and imp_date<=20130317 and uin>0 and cid='6ogot0tb9mv151l'
)b
on (a.uin=b.uin)
where b.uin is NULL
上面这个用 join
连接
select DISTINCT uin from table4
where imp_date>=20130311 and imp_date<=20130317 and vid='b0012jqmxne'
and uin>0 and play_cnt>0
on uin相同。。
老是通不过