搞死我五天的SQL
DogJay
2017-12-02
【后端技术】
540人已围观
SELECT
*
FROM
(
SELECT
dd.*,
CASE
pstatus
WHEN '1' THEN
'13222'
WHEN '2' THEN
'13223'
WHEN '3' THEN
'15042'
WHEN '4' THEN
'13225'
WHEN '5' THEN
'17000'
WHEN '6' THEN
'48322'
WHEN '7' THEN
'49102'
END AS processstatus,
to_number(
decode(
dd.swnumber,
'下级单位',
'0',
'上级单位',
'0',
'外单位',
'0',
'市政府',
'0',
dd.swnumber
)) AS bb
FROM
(
SELECT
t.swid,
t.filedate swdate,
t.id,
t.swunit,
t.filezh,
t.num,
t.title,
t.swtype,
t.modelid,
t.instanceid,
substr(
t.swid,instr( t.swid, '-' ) + 1,
length( t.swid )) AS swnumber,
CASE
t.flag
WHEN '2' THEN
'3'
WHEN '4' THEN
'4'
WHEN '5' THEN
'5'
WHEN '6' THEN
'6'
WHEN '7' THEN
'7'
ELSE to_char( ins.status )
END AS pstatus,
T.REMARK
FROM
incidents ins,
t_doc_receive t
WHERE
t.removed = 0
AND ins.processname = t.modelid
AND to_char( ins.incident ) = t.instanceid
AND ins.status IN ( 1, 2, 8 )
AND t.modelid = '收文流程'
) dd
WHERE
1 = 1
)
WHERE
1 = 1
AND (((
processstatus = '17000'
)))
ORDER BY
bb;
吐槽(0)
上一篇:拉萨项目的saltstack
下一篇:服务端结合客户端JS解决跨域问题