在线等候,SQL语法问题
SELECT ps0.PK_TROUBLE_REPAIR_ID pkid,
ps0.WORKFLOW_DEF_NO,
ps2.remark,
ps0.STATE AS STATE,
to_char(SEGNO) as projectNo,
CONTENT || '(' || SECTIONS || '标)' AS PROJECT_NAME,
ps0.TACHE_MAN as TACHE_MAN,
to_char(x.REVERT_DATE, 'YYYY-MM-DD HH24:MI:SS') REVERT_DATE
FROM (select *
from T_TROUBLE_REPAIR t
order by t.PK_TROUBLE_REPAIR_ID desc) ps0
left outer join t_workflow_def ps2 on ps0.WORKFLOW_DEF_NO =
ps2.WORKFLOW_DEF_NO
left outer join (select x1.*
from t_workflow_history x1
where x1.rowid in (select max(x2.rowid)
from t_workflow_history x2
group by x2.opt_no)) x on ps0.PK_TROUBLE_REPAIR_ID =
x.opt_no
where 1 = 1
and DECODE(ps0.WATCHNOTION, '', '0', '1') = '1'
and DECODE(ps0.DADUI_SIGN, '', '0', '1') = '0'
and ps0.STATE = '监理已验收'
and ps0.POPEDOM = '东山大队'
and ps0.STATE = '监理已验收'
and ps0.report_time >=to_date('2010-06-16 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
and ps0.owner in ('不属支队', '市交委', '项目办', '区市政', '水务局', '公路局', '不属支队通知相关单位', '地铁')
and ps0.TACHE_ORDER = '3'
and ps0.STATE = '监理已验收'
and ps0.POPEDOM = '东山大队'
and ps0.STATE = '监理已验收'
and ps0.report_time >=to_date('2010-06-16 00:00:00', 'yyyy-mm-dd hh24:mi:ss')
满足这个的查出来
and ps0.owner in ('不属支