Sql Oracle查询订单依据
嗨,我的DOMP_LOG_事件表中有这些数据Sql Oracle查询订单依据,sql,oracle,oracle11g,Sql,Oracle,Oracle11g,嗨,我的DOMP_LOG_事件表中有这些数据 DOCID DOC_VERSION CN_NO SEQ USERID EVENT_DESC DATE_LOG REMARKS UPLOAD_DATE 7a32bf6024264a109ce32d05c52d70f8 0 0 PHG01096 Document created 7/7/2020 8:44:36 AM
DOCID DOC_VERSION CN_NO SEQ USERID EVENT_DESC DATE_LOG REMARKS UPLOAD_DATE
7a32bf6024264a109ce32d05c52d70f8 0 0 PHG01096 Document created 7/7/2020 8:44:36 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 PHG01096 Document Submitted for Review 7/7/2020 8:45:30 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 PHG00583 Document reviewed 7/7/2020 8:46:19 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 DOMSYS 3.0 Document Submitted for Approval 7/7/2020 8:46:19 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 NXP16848 Document Approved 7/7/2020 8:47:18 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 PHG01925 Document Approved 7/7/2020 8:48:09 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 DOMSYS 3.0 Document Submitted for Publication 7/7/2020 8:48:09 AM
7a32bf6024264a109ce32d05c52d70f8 0.01 0 NXP74045 Document Published 7/7/2020 8:49:04 AM
7a32bf6024264a109ce32d05c52d70f8 0 0 PHG01096 Document Deployed 7/7/2020 8:50:33 AM
7a32bf6024264a109ce32d05c52d70f8 0 1 DOMSYS 3.0 Document Submitted for Deployment 7/7/2020 8:50:33 AM
我想得到这样的查询结果
提交以供部署的文档
应在部署的文档
这是我目前的问题
Select doc_version, date_log, event_desc, userid, nvl(fullname,userid) as fullname from domp_log_event A, dom_appusers b
where a.userid = b.username(+) and round(doc_version) = '0' and docid ='7a32bf6024264a109ce32d05c52d70f8' order by docid, date_log,userid DESC, seq ,doc_version
如何在不更改表中数据的情况下实现它我再次查看了示例数据,我认为以下
按顺序
将起作用:
ORDER BY DOCID,
DOC_VERSION DESC,
DATE_LOG,
DECODE(EVENT_DESC,'Document Submitted for Deployment',1,
'Document Deployed',2,
3) -- added this
学习使用正确、明确、标准、可读的
JOIN
语法。