View Single Post
  #6 (permalink)  
Old 01-12-10, 18:18
MarkATrombley MarkATrombley is offline
Registered User
 
Join Date: Jul 2009
Location: Michigan
Posts: 125
I would only use the Calendar table as a way to know every day of the month. You could either build a regular table and populate it for the next 10 years OR build a temp table and populate it for the month you are looking at. Either way is valid.

By having only an events table you have to generate a day, loop through the events you have in your result set, generate the next day, loop through the events again, etc. If you generate all of the days into a temp table then use a join you end up with:

1/1/2010, 'New Years Day'
1/2/2010, NULL
1/3/2010, 'Jims birthday'
1/3/2010, 'Dentist appointment'
1/4/2010, NULL
etc.

Either way I see no reason for a boolean that says there is an event for that day. And if you don't want to store a permanent calendar table it shouldn't take long to build and populate a temp table.

Try both and see which is faster, generating a temp calendar table and doing the join or looping through the event result set for each day. Maybe processor speed will win over database speed.
Reply With Quote