网络编程
位置:首页>> 网络编程>> 数据库>> Oracle将查询的结果放入一张自定义表中并再查询数据

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

作者:whsnow  发布时间:2024-01-24 18:23:56 

标签:查询结果,自定义表

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


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;
0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com