title: Alter a existing SQL statement, to give an additional column of data, but to not affect performance, so best approach
body: <p>In this query, I want to add a new column, which gives the SUM of a.VolumetricCharge, but only where PremiseProviderBillings.BillingCategory = 'Water'. But i don't want to add it in the obvious place since that would limit the rows returned, I only want it to get the new column value</p>
  <pre><code> SELECT b.customerbillid,
           -- Here i need  SUM(a.VolumetricCharge) but where a.BillingCategory is equal to 'Water'
           Sum(a.volumetriccharge)                AS Volumetric,
           Sum(a.fixedcharge)                     AS Fixed,
           Sum(a.vat)                             AS VAT,
           Sum(a.discount) + Sum(deferral)        AS Discount,
           Sum(Isnull(a.estimatedconsumption, 0)) AS Consumption,
           Count_big(*)                           AS Records
    FROM   dbo.premiseproviderbillings AS a WITH (nolock)
           LEFT JOIN dbo.premiseproviderbills AS b WITH (nolock)
                  ON a.premiseproviderbillid = b.premiseproviderbillid
    -- Cannot add a where here since that would limit the results and change the output
    GROUP  BY b.customerbillid;
  </code></pre>