oracle一周内日期查询
Sql代码 www.2cto.com
select *
from (SELECT a.*,
(select count(distinct b.fee_name)
&oracle账号nbsp; from biz_patent_fee_notice b
where b.main_id = a.id) notices,
(select count(distinct b.fee_name)
from biz_patent_fee_notice b
where b.main_id = a.id
and to_date(b.notice_date)-trunc(sysdate) between 1 and 7) dueNotices,
(select count(distinct b.fee_name)
from biz_patent_fee_notice b
where b.main_id = a.id
and sysdate > b.notice_date) seniorNotices
FROM biz_patent_fee_main a
where 1 = 1
order by ID asc)
where rownum <= 10