title: subquery rules in the union function postgresql
body: <p>I want to make a report with results from different Tables</p>
  
  <pre><code>SELECT week, countA, countB
  FROM (
   (SELECT week, COUNT(*) AS countA FROM dataA a
   GROUP BY 1 )
   UNION
   (SELECT week , COUNT(*) AS countB FROM dataB 
    WHERE blablabla ...  GROUP BY 1) b
    ) c
  </code></pre>
  
  <p>now I have some issues</p>
  
  <ul>
  <li><p>he don't want that the subquery b has a name</p></li>
  <li><p>he don't know what countB is, if I don't give the 2nd query a name</p></li>
  <li><p>I get confused and don't know if and where I should put the name for the 2nd query</p></li>
  </ul>
  
  <p>Is their a solution for that and is their some kind of "rulebook" because I get confused every time I work with the UNION function</p>