作者:wan乄etsnyd | 来源:互联网 | 2014-07-09 16:02
oracle一周内日期查询Sql代码www.2cto.comselect*from(SELECTa.*,(selectcount(distinctb.fee_name)frombiz_patent_fee_noticebw...SyntaxHighlighter.all();
oracle一周内日期查询
Sql代码 www.2cto.com
select *
from (SELECT a.*,
(select count(distinct b.fee_name)
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