Oracle puts the query results into a custom table and then queries data.
The actual example code below can put the query results into a custom table and query data from this custom table:
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;
How can I insert the queried data into another table in oracle?
Insert into t_tab
Select * from s_tab where Condition
The view can be seen as the deformation of one or more tables in the mirror,
As long as the table changes, the view content also changes.
How to display multiple query results in one table in oracle
-- You can use external join in sql99 syntax, as shown below:
SELECT
Case when table 1. Name IS NOT NULL
THEN table 1. Name
Else case when table 2. Name IS NOT NULL
THEN Table 2. Name
Else case when table 3. Name IS NOT NULL
THEN Table 3. Name ELSE 'unknown'
END
END
End as name
, Table 1. Number of people, Table 2. Number of people, Table 3. Number of people
FROM table 1 FULL OUTER JOIN
T2 ON table 1. Name = TABLE 2. Name
FULL OUTER JOIN
T3 ON table 1. Name = TABLE 3. Name
-- If there are more than n tables in this method, the name will be tedious to write, but the idea should be fine.
-- If it looks troublesome, you can change the statement between select and from to *. I believe you can understand the result.