title: add select query result from tableA as a new column in tableB
body: <p>I am creating a new table from joining two tables through below query:</p>
  <pre><code>select a.name, a.number, b.id, b.sub_num
      from tableA a left join
           tableB b
           on a.number = concat(id,'-',Cast(sub_num as varchar);
  </code></pre>
  <p>Here, I want to add a <code>new column</code> into the new table which is select query result on tableA.</p>
  <p>The table data would be something like below:
  <a href="https://i.stack.imgur.com/Z9TdF.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>I am trying to use below query which is not correct as it is giving me multiple rows. I need sum of dext_number for condition dext_id = 17501 and group by of name and number columns.</p>
  <pre><code>select a.name, a.number, b.id, b.sub_num, 
     (select sum(dext_number) from tableA where dext_id = 17501 group by name, number) as newcol 
       from tableA a left join tableB b 
    on a.number = concat(id,'-',Cast(sub_num as varchar);
  </code></pre>
  <p>What is the best way to add this column here?</p>