Anyone knows how to put a GROUP BY under a compound query? It means that 2 queries joined by UNION and GROUP BY at the end of the 2 queries instead of GROUP BY each of them individually. Pls refer to the following example!
Select
COL1,
COL2,
From
TABLE1,
TABLE2
WHERE
...
UNION
Select
COL3,
COL4,
From
TABLE3,
TABLE4
Where
...
GROUP BY
...
Select
COL1,
COL2,
From
TABLE1,
TABLE2
WHERE
...
UNION
Select
COL3,
COL4,
From
TABLE3,
TABLE4
Where
...
GROUP BY
...