i have a table like as student.
m having data from 31/06/2009 till 06/08/2015
where i always put the records of all the students on daily basis so now i want to find out the dates in which i haven't added the data in student table.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Rohan GuptaRank #2,588 · 539 reputationPosted Aug 6, 2015, 11:54 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 7, 2015, 12:01 AM EDT
ravi rawat30 reputationPosted Aug 7, 2015, 1:35 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Aug 7, 2015, 4:26 AM EDT
DECLARE @s DATE = '20150418', @e DATE = '20150708';
SELECT c.d, ID = COALESCE(s.ID,0)
FROM
(
SELECT TOP (DATEDIFF(DAY, @s, @e)+1)
DATEADD(DAY, ROW_NUMBER() OVER (ORDER BY number)-1, @s)
FROM [master].dbo.spt_values
WHERE [type] = N'P' ORDER BY number
) AS c(d)
LEFT OUTER JOIN [dbo].[PhotograperRegistration] AS s
ON c.d = s.Profile_CreatedDT
WHERE c.d >= @s
AND c.d < DATEADD(DAY, 1, @e);