Append query...how to?

leddy

New member
Local time
Today, 04:21
Joined
Jul 3, 2008
Messages
9
Hi everyone,

In desperate need of help! :o)

I have two temp tables, temp_qryTotals and temp_qryTotalsOnService
temp_qryTotals:
sDate
TimeSlot
sCount
eCount

temp_qryTotalsOnService:
sDate
TimeSlot
osCount

What I need to do is if there is a record in temp_qryTotalsOnService, where the sDate and TimeSlot are not in temp_qryTotals, then I need to append the record to temp_qryTotals (osCount = sCount).

How can I achieve this please?

Any ideas, even to get me on track, would be great - I've been working on this for two days and am slowly losing the will to live! :eek: :p

Many thanks in advance

leddy :D
 
Start by using the wizard to create a find unmatched query. Then create an append query based on the unmatched query.
 
INSERT INTO temp_qryTotals ( SDate, TimeSlot, SCount )
SELECT temp_qryTotalsOnService.SDate, temp_qryTotalsOnService.TimeSlot, temp_qryTotalsOnService.OSCount
FROM temp_qryTotalsOnService LEFT JOIN temp_qryTotals ON (temp_qryTotalsOnService.TimeSlot = temp_qryTotals.TimeSlot) AND (temp_qryTotalsOnService.SDate = temp_qryTotals.SDate)
WHERE (((temp_qryTotals.SDate) Is Null));
 
Thank you both so much, got it sorted! :D

leddy
 

Users who are viewing this thread

Back
Top Bottom