title: Consolidate SQL Union With JOIN
body: <p>Let's say I have 2 tables (<code>bar_helper</code> and <code>bar</code>). I have a query that retrieves records based on a <code>JOIN</code> between the tables and some condition.</p>
  <p>Essentially, my first result set is joined and I want my second one to be unconditional and just based on one table.</p>
  <pre><code>SELECT DISTINCT a.barId, b.foo 
  FROM bar_helper a 
      JOIN bar b ON a.barId=b.id
  WHERE a.color='blue' AND b.type='wood';
  </code></pre>
  <p>This works fine. However, now I need to also get a second set of <code>bar</code> records (unconditional of <code>bar_helper</code>). I don't want to execute a second query and then merge results. It looks like I can solve this with <code>UNION</code> (not using <code>All</code> bc deduped is fine)</p>
  <p>So now my query would be something like.</p>
  <pre><code>SELECT DISTINCT a.barId, b.foo 
  FROM bar_helper a 
      JOIN bar b ON a.barId=b.id
  WHERE a.color='blue' AND b.type='wood'
  
  UNION
  
  SELECT id, foo
  FROM bar where magnitude=10;
  </code></pre>
  <p>This seems to work and I get 1 resultset that combines both. Is there a more consolidated way to do this though? Can I just use <code>OR</code>. The <code>JOIN</code> is what's confusing me. I'm looking for something that's like..
  &quot;get these first set of results&quot;.....&quot;but...also...get these too&quot;.</p>
  <p>Any insights?</p>