I have two tables tbl_DaysWeeksMonths (Left Table) and tbl_Telephony (Right Table). tbl_DaysWeeksMonths has a record of every day of the year with columns (Row_Date/Week/Month) whilst tbl_Telephony has telephony data for hundreds of agents by day with columns (row_date/agent/calls/talk time)(Note: Each agent only has records for 5-6 days of the week instead of everyday).
I want to join the two tables so that each agent has a record for every day of the week regardless if they took calls on a day or not. I want to display blank records (except for the date field) for days which consultants did not take calls. E.g:
## Date ## ## Agent ## ## Calls ## ## Talk Time ##
1. 26/05/2012 | James | 40 | 560
2. 27/05/2012 | James | |
3. 28/05/2012 | James | 34 | 456
4. 29/05/2012 | James | |
5. 30/05/2012 | James | 40 | 643
6. 31/05/2012 | James | 36 | 345
7. 01/06/2012 | James | 31 | 160
I'm trying to use the below code but I don't think it's correct. Any suggestions on a better code to use. Please help.
SELECT tbl_DaysWeeksMonths.Row_Date,
[tbl_Telephony].Consultant,
[tbl_Telephony].i_acdtime
FROM tbl_DaysWeeksMonths
LEFT JOIN [tbl_Telephony]
ON tbl_DaysWeeksMonths.Row_Date = [tbl_Telephony].row_date;
{}for a neater layout. - Fionnuala