试试下面语句:
SELECT SID, SSJSID, RQ, SJ FROM JING_SS
Where to_char(rq,'yyyyMMdd') between 开始日期 and 结束日期 and
not to_char(sj,’hh24mmss')<开始时间and to_char(rq,'yyyyMMdd')=开始日期 and
not to_char(sj,'hh24mmss')>结束时间and to_char(rq,'yyyyMMdd')=结束日期 and
ssjsid in (select sid fromcom_dw connect by prior sid=fid start with sid=单位编号)
Order by sid;