日期:2014-05-16 浏览次数:20716 次
select a.EntryId,format(b.date,'yyyy-mm-dd') as cdate, count(*) as visit, (select count(*) from (select distinct ip from 表2 where EntryId=a.EntryId and int(date)=int(b.date))) as ip_visit from 表1 a inner join 表2 b on a.EntryId=b.EntryId group by a.EntryId,format(b.date,'yyyy-mm-dd')
------解决方案--------------------
select a.entryid,date,count(date) as visit,count(distinct ip) as visit_ip from 表1 a left join 表2 b on a.EntryId=b.EntryId group by a.EntryId,date;