Hello Marquesjr,
From what I understand, what you really need to do is relate the two queries (and not unite).
In SQL, you can treat these two queries as if they were "views" .. and do select and joints with them.
You could do something like:
Select all
padrão "SQL antigo":
SELECT <colunas>
FROM (<primeira querie>) A,
(<segunda querie>) B
WHERE <condicoes>
NOVO padrão "ANSI":
SELECT <colunas>
FROM (<primeira querie>) A
JOIN (<segunda querie>) B
ON (<condicoes>)
Only you need to take some care:
[ (99] a) Columns with AVG, count, sum, etc. Need to have an associated alias / header
b) the two queries you raised .. they return exactly the same amount of products? If you do not return, you need to evaluate if at least one of them presents all products and use an Outer Join (which could be a Left Outer Join or a Right Outer Join - "in the ANSI standard" - or the use of (+) in the old Oracle standard)
c) If none of the two queries feature all products and you need a complete relationship, you may have to add a third table (eg products) in your queries.
Hugs,
Sergio Coutinho