title: Group by in subquery and base query sql server
body: <p>I want to know if the following is possible.</p>
  <p>I have one table of which I want to retrieve 3 columns of data:</p>
  <p>Day, Sum of hours worked, Sum of hours worked with condition</p>
  <p>My query is</p>
  <pre><code>SELECT     Day, SUM(Regular + Extra + Overtime) AS [Potential Hours],
                        (SELECT     SUM(Extra + Regular + Overtime) AS Expr1
                          FROM          dbo.TICPlus_Effort_Billable_Only
                          WHERE      (Manager NOT LIKE '%manager1%')) AS [Billed Hours]
  FROM         Billable AS Billable1
  GROUP BY Day
  </code></pre>
  <p>With this query I get the sum of all the data in the subquery for each row, but I would like to have the subquery that includes the constraint to be grouped by day. Is it possible to have a group by in the subquery to do this so I get the daily sum with condition on a daily basis?</p>