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