
--查询独舞的囝囝的国庆期间的女人数
select name,(case when a.status='1' then '已射'
when a.status='2' then '未射'
else '阳痿' end) as status,count( distinct 女人)
from 独舞的囝囝 a
where date between to_date('2012-10-01 00:00:00','yyyy-mm-dd hh24:mi:ss')
and to_date('2012-10-08 23:59:59','yyyy-mm-dd hh24:mi:ss')
and a.weapon in ('JJ','手指','火腿肠','黄瓜')
and a.duration <=15
group by name,(case when a.status='1' then '已射'
when a.status='2' then '未射'
else '阳痿' end)
having count(OOXX)>=1
select name,(case when a.status='1' then '已射'
when a.status='2' then '未射'
else '阳痿' end) as status,count( distinct 女人)
from 独舞的囝囝 a
where date between to_date('2012-10-01 00:00:00','yyyy-mm-dd hh24:mi:ss')
and to_date('2012-10-08 23:59:59','yyyy-mm-dd hh24:mi:ss')
and a.weapon in ('JJ','手指','火腿肠','黄瓜')
and a.duration <=15
group by name,(case when a.status='1' then '已射'
when a.status='2' then '未射'
else '阳痿' end)
having count(OOXX)>=1