title: UNION ALL Sql query - how to bind three tables
body: <p>I have the following tables:</p>
  
  <p>T1</p>
  
  <pre><code>  ID  PRIORITY
    1      1
    2      1
    3      2
    4      4
  </code></pre>
  
  <p>T2</p>
  
  <pre><code>ID  SERVICE
  1   PSTN
  1   ADSL
  3   ADSL
  </code></pre>
  
  <p>T3</p>
  
  <pre><code>ID   DEVICE
  1    BSC1
  3    BSC7 
  4    BSC7
  </code></pre>
  
  <p>I want as output</p>
  
  <pre><code>ID  PRIORITY SERVICE/DEVICE
  1      1        PSTN
  1      1        ADSL
  1      1        BSC1
  2      1
  3      2        ADSL
  3      2        BSC7
  </code></pre>
  
  <p>How to bind those tables using UNION ALL? Also I must put WHERE clause for T1  <code>WHERE PRIORITY!=4</code></p>
  
  <p>Total number in output table for one id should be the summary of T2+T3 (FOR ID=1 2+1=3) but for ID=2 it also <strong>SHOULD</strong> exist in table output with blank second column.</p>
  
  <p>Thank you</p>