Finding the Difference of the days in T-SQL
<p>My table detail is :</p>

<pre><code>Date                ORGUnitCode SKUId   LocationID  LP  DivisionCode    DeptCode    CategoryCode    OPBalQty    OPBalValue  Sync    
2013-03-31 00:00:00 DELG14  10059764    107       432.55    G           MN          KLO             0.00            0.00    0   
2013-03-31 00:00:00 DELG14  10063213    107       699.05    G           MN          KLO             0.00            0.00    0   
2013-03-31 00:00:00 DELG14  10090728    107       250.76    G           MN          PYJ             0.00            0.00    0   
</code></pre>

<p>Here <code>OPBalQty</code> is either <strong>1.00</strong> or <strong>0.00</strong> in a huge number of records.</p>

<p>I want to find out the number of the days since <code>OPBalQty</code> is <strong>0.00</strong> for all available <code>SKUId</code>, rephrasing it to be find particular skuId that is stockOut for the number of the days. I have tried to find it but not working can anyone point to this? </p>