title: how to get count of days when it not ran on Target date
body: <p>I have an sample data like this : </p>
  
  <pre><code>DECLARE @T Table (ID INT, Name VARCHAR(10), DOB DATE)
  
  INSERT INTO @T (ID,Name,DOB) VALUES (1,'Mohan','2016-11-11')
  INSERT INTO @T (ID,Name,DOB) VALUES (2,'Raj','2016-11-07')
  INSERT INTO @T (ID,Name,DOB) VALUES (3,'Manny','2016-10-30')
  INSERT INTO @T (ID,Name,DOB) VALUES (4,'kamal','2016-11-01')
  INSERT INTO @T (ID,Name,DOB) VALUES (5,'Raj','2016-11-08')
  INSERT INTO @T (ID,Name,DOB) VALUES (6,'Manasa','2016-11-10')
  </code></pre>
  
  <p>My question is when I run the query on this table on Sunday (i.e 06/11/2016)</p>
  
  <p>For example :</p>
  
  <pre><code>Select Count(*), Cnt  
  from @T      /* how to write logic for missing days */
  </code></pre>
  
  <p>My output : </p>
  
  <pre><code>Cnt   Days
  6    0 Days 
  </code></pre>
  
  <p>Same thing when I run it on Thursday (i.e 06/11/2016)</p>
  
  <pre><code>Cnt   Days
  6     4 Days
  </code></pre>
  
  <p>How I need to get this one. Every Sunday it will run if it ran on Saturday it should show 6 days and Sunday to Sunday calculation.</p>
  
  <p>Please suggest some way of doing this - I'm unable to move forward </p>