SUM() column based on other columns
<p>I have table with sales plan data for every week, which consists of few columns:</p>

<pre><code>SAL_DTDGID -- which is date of every Sunday, for example 20160110, 20160117
SAL_MQuantity --sum of sales plan value
SAL_MQuantityYTD --sum of plans since first day of the year 
SAL_CoreElement --sales plan data for few core elements
SAL_Site --unique identifier of place, where sale has happened
</code></pre>

<p>How do I sum values in SAL_MQuantityYTD as values of SAL_MQuantity since first records in 2016 to 'now' for every site and every core element?</p>

<p>Every site mentioned in <code>SAL_Site</code> has 52 rows corresponding week count in a year along with 5 different <code>SAL_CoreElement</code>'s
Example:</p>

<pre><code>SAL_DTDGID|SAL_MQuantity|SAL_MQuantityYTD|SAL_CoreElement|SAL_Site
20160110  |20000        |20000           |1              |1234
20160117  |10000        |30000           |1              |1234
20160124  |30000        |60000           |1              |1234
</code></pre>

<p>If something isn't clear I'll try to explain.</p>