欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2023-11-06 23:45:52
如下的实际例子代码可以将查询的结果放入到一张自定义表中,同时可以再从这个自定义的表中查询数据: with aa as (select ticketnumber,...

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

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;