1、站點表 lw_sitespa
站點id 站點名稱 站點路徑it
lw_site_id site_name static_dirio
2、欄目表 lw_channeldate
欄目id 站點id 欄目名稱 select
lw_channel_id lw_site_id channel_namechannel
3、文章表lw_contentim
文章id 欄目id 文章標題 文章發佈時間 文章發佈狀態查詢
lw_content_id lw_channel_id article_title publish_date publish_statestatic
查詢站點下,所屬欄目爲「警務資訊」及其子孫欄目,發佈時間在startTime和endTime之間,發佈狀態不爲「09」的文章數量?di
select ls.site_name,ls.static_dir,count(ls.site_name) as total from lw_site ls,
(select ch.lw_channel_id as channelid,ch.lw_site_id as siteid from lw_channel ch start with ch.channel_name ='警務資訊' connect by prior ch.lw_channel_id = ch.parent_id ) tempt,
(select c.lw_channel_id as chnnalid2,c.status as statue from lw_content c where c.publish_date > to_date('"+ startDate +"','yyyy-mm-dd hh24:mi:ss')and c.publish_date < to_date('"+ endDate +"','yyyy-mm-dd hh24:mi:ss')) temp2
where tempt.siteid = ls.lw_site_id
and temp2.chnnalid2 = tempt.channelid and ls.parent_id ='lw_site_id'
and temp2.statue <> '09'
group by ls.site_name,ls.static_dir
order by total desc