I have the following query, which gives me the provider for a given title:
SELECT DISTINCT(provider) FROM
(SELECT title, provider FROM financials_raw
UNION
SELECT title, provider from sales_raw
) combined
WHERE title = 'Home'
However, this will return NULL provider results as well, how would I exclude all null results?
Further to my comment above, the following query will accomplish the same but be more efficient (as undesirable records are not first being joined in the
UNIONoperation before subsequently being filtered from the materialised table):Note that
UNION(without theALLqualification) impliesDISTINCT.