首页 > 数据库 > Oracle > 正文

Oracle将查询的结果放入一张自定义表中并再查询数据

2020-07-26 14:17:53
字体:
来源:转载
供稿:网友

如下的实际例子代码可以将查询的结果放入到一张自定义表中,同时可以再从这个自定义的表中查询数据:

with AA as(SELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED,GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME,LASTNAME, NUMBEROFDAYSFROM REPORT_PERFORMANCEOFANALYZERWHERE (DTANALYZED IS NULL)UNION ALLSELECT TICKETNUMBER, TICKETTYPE, VERSIONNUMBER, STAGENAME, DTANALYZED,GISPROCESSID, PROCESSSTATUS, DTRECEIVED, USERID, USERNAME, FIRSTNAME,LASTNAME, NUMBEROFDAYSFROM 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) COUNTTICKETSFROM AAORDER BY USERNAME;

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表