Oracle将查询的结果放入一张自定义表中并再查询数据
时间:2022-07-13 08:27:40|栏目:Oracle|点击: 次
如下的实际例子代码可以将查询的结果放入到一张自定义表中,同时可以再从这个自定义的表中查询数据:
with AA as (SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED, GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME, LASTNAME, NUMBEROFDAYS FROM REPORT_PERFORMANCEOFANALYZER WHERE (DTANALYZED IS NULL) UNION ALL SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED, GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME, LASTNAME, NUMBEROFDAYS FROM REPORT_PERFORMANCEOFANALYZER REPORT_PERFORMANCEOFANALYZER_1) SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED, GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME, LASTNAME, NUMBEROFDAYS, (SELECT COUNT(GISPROCESSID) AS COUNTTICKETS FROM AA) COUNTTICKETS FROM AA ORDER BY USERNAME;
上一篇:Oracle表字段的增删改、表的重命名及主键的增删改
栏 目:Oracle
下一篇:在Spring中用select last_insert_id()时遇到问题
本文标题:Oracle将查询的结果放入一张自定义表中并再查询数据
本文地址:http://www.codeinn.net/misctech/207657.html