I just want to know the internal execution of this query especially how the values in from subquery are being used
SELECT bu, location FROM
(
SELECT DISTINCT bu, hqname, location FROM DOCTOR
UNION
SELECT DISTINCT bu, hqname, location FROM CHEMIST
UNION
SELECT DISTINCT bu, hqname, location FROM STOCKIST
)
GROUP BY bu, location
HAVING COUNT (DISTINCT hqname) > 1;