union query (I assume)

Dear experts -
I have 1 table ('timesheet_summary') that contains a date (always a Monday), a person ID (numeric), a total hours, and a few other fields.
I have another table (calendar table) that contains all Mondays.
What I want to do is populate a new table (temp table) that, for a given period (I would like to have the flexibility of specifying this) would generate one record for every Monday; it would grab all records that exist in the 'timesheet_summary' table FOR THAT PERSON, and would create a new record for every Monday in that period that didn't exist in the 'timesheet_summary' table.
EXAMPLE:
person = '13'; date range = from 2 March 2015 to 30 Marc h 2015 (five Mondays)
timesheet_summary table contains these records
2 March 2015; person = 13; total = 10 hours
16 March 2015; person = 13; total = 8 hours

Now, when I run this query (union query?) the output would be:
2 March 2015; person = 13; total = 10 hours
9 March 2015; person = 13
16 March 2015; person = 13; total = 8 hours
23 March 2015; person = 13
30 March 2015; person = 13

Any suggestions are appreciated...
terpsichoreAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aikimarkCommented:
You can do this with a tally table (numbers table).  I show an example of generating dates in this article:
http:A_5410.html
chaauCommented:
In my opinion a simple left join will return the query you are after. You can even create it with the built-in Query Wizard. The resulting query will be similar to this:
SELECT calendar.dt, [ParamPerson] as PersonID, timesheet_summary.totalHours
FROM calendar LEFT JOIN timesheet_summary
ON calendar.dt = timesheet_summary.dt
WHERE timesheet_summary.PersonID = [ParamPerson] AND
calendar.dt >= [ParamFromDate] AND calendar.dt < [ParamToDate]

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PortletPaulEE Topic AdvisorCommented:
if that calendar table does contain all Mondays then the left join will be sufficient (as proposed by chaau)

if that calendar table has gaps, then a left join will not be sufficient and you will need to generate the Mondays
terpsichoreAuthor Commented:
this seems to do the trick. thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.