title: SQL query two queries and union
body: <p>I've these two approaches for a problem and they look kind of okay to me. Is there a better way to do this? Please advise. </p>
  
  <p>X,Y,Z are same for both queries
  <br> <br> 
  <strong>Two queries and add the values:</strong><br> 
  select sum(columnA1), sum(columnA2) from tableA 
  where columnA3 = X and columnA4 = Y and columnA5 = Z;<br> 
  select sum(columnB1) from tableB
  where columnB3 = X and columnB4 = Y and columnB5 = Z;
  <br> <br> 
  <strong>Union All:</strong>
  select sum(columnA1), sum(columnA2), sum(columbB1)
  from (select columnA1, columnA2, null from tableA
  where columnA3 = X and columnA4 = Y and columnA5 = Z
  union all 
  select null, null, columnB1 from tableB
  where columnB3 = X and columnB4 = Y and columnB5 = Z) unionresult</p>