select count(1) from
(
select userId ,count( distinct( date_format(createTime,'%Y%m%d') )) from session_user
where date_format(createTime,'%Y%m%d') between '20110725' and '20110731'
group by userId
HAVING count( distinct( date_format(createTime,'%Y%m%d') )) >=3
)
as tmp;
(
select userId ,count( distinct( date_format(createTime,'%Y%m%d') )) from session_user
where date_format(createTime,'%Y%m%d') between '20110725' and '20110731'
group by userId
HAVING count( distinct( date_format(createTime,'%Y%m%d') )) >=3
)
as tmp;