 <p>You could also use analytic functions to compute the number of NULL values for the name and filter by that:</p> <pre><code>with v_data as ( select name, value from table1 union select name, value from table2 ) select v2.* from ( select v1.*, count(value) over (partition by name) as value_cnt from v_data v1 ) v2 where value_cnt = 0 or value is not null </code></pre>