select c.bureau_no,d.site_no,
count (distinct case when b.offer_type='e6' then a.id end ) as t,
count (distinct case when b.offer_type='e6' and to_char(a.date, 'ww') = to_char(sysdate, 'ww') then a.id end ) as t1,
count (distinct case when b.offer_type='e6' and to_char(a.date, 'ww') = to_char(sysdate -1, 'ww') then a.id end ) as t2,
count (distinct case when b.offer_type='e6' and to_char(a.date, 'ww') = to_char(sysdate -2, 'ww')then a.id ) as t3
from TABLENAME a,请大家帮我解决下 为何 我的T1,T2,T3 取出来的数值是一样的? 特郁闷 谢谢大家了
--
15SQL> ed
ÒÑдÈëÎļþ afiedt.buf 1* select to_char(sysdate-1,'ww') from dual
SQL> /TO
--
15SQL> ed
为什么一样说明在同一周啊
--
15SQL> ed
已写入文件 afiedt.buf 1* select to_char(sysdate-1,'ww') from dual
SQL> /TO
--
15为什么一样说明在同一周啊
-----------------------
14SQL> select to_char(sysdate,'ww')-2 from dual;TO_CHAR(SYSDATE,'WW')-2
-----------------------
13SQL>
这样吧,楼主懂吗