How to groupby week from a given date range SQL Server and return count 0 if no data found for a week
<p>I want the selected data in below format.</p>

<pre><code>TOTAL_FEE                WEEK
+---------------+--------------+
  24000                 WEEK_1
  24000                 WEEK_2
  24000                 WEEK_3
</code></pre>

<p>My query that give me result groupby date is :</p>

<pre><code>select  count(*) * 24000, CAST(p.submited_date  AS DATE)
from Form_For_Business_Name_Registration p 
where p.STATUS !='NS' 
and CAST(p.submited_date  AS DATE)&gt;='2016-01-22' 
and CAST(p.submited_date  AS DATE)&lt;='2016-03-04'   
GROUP BY CAST(p.submited_date  AS DATE)
</code></pre>

<p>What i want is to get results groupby weeks but weeks should be calculated from the given date range.</p>

<p>Note : if there is no data for the week it should return 0 counts for that week.</p>

<p>Will somebody guide me to write a SQL query to get desired output.</p>

<p>Thank you!</p>