November 21, 2009 at 8:06 am
I have a query where I am pulling data on daily basis for a specific start and end dates. For some of the days ex Sunday we have no row for that day in the database but user want to display the date and count as 0. I am not sure how can we display the date when no row/record for that day exist in database. can anyone please give me idea.
November 21, 2009 at 10:31 am
ISNULL(YourTable.DateField,GETDATE() ) DateField, ISNULL(CountField, 0) CountField
Note that that code displays the exact date with the time portion, you could also trim off the time portion to show just the date. If you want a more fitting answer for your scenario, post the query.
November 21, 2009 at 1:45 pm
This common requirement usually can be resolved using a calendar table.
Search this site for "calendar table" and you'll find a variety of solutions and discussions related to it.
If you have more detailed requirements, please provide more detailed information.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply