Difference between queries

  • Thread starter Thread starter rbeach
  • Start date Start date
R

rbeach

I have two queries (LocalEntries,ImportedEntries), one is part of the
database and the other is imported from another program. Both queries have
the same info (StartDate,EndDate,Category,SubCat). What can I use to obtain a
list of records that are in the LocalEntries query that are not listed in the
ImportedEntries query?

FYI: The date and time stamps for StartTime and EndTime are identical in
both queries.
 
SELECT *
FROM LocalEntries
WHERE Not Exists
(SELECT * FROM ImportedEntries
WHERE ImportedEntries.StartDate = LocalEntries.StartDate
AND ImportedEntries.EndDate = LocalEntries.EndDate)
AND ImportedEntries.Category = LocalEntries.Category)
AND ImportedEntries.SubCat = LocalEntries.SubCat) ;
 
This formula gives the error "extra ) in query expression...". I have tried
different places to add the parenthesis but to no avail. please help.
 
Extra mean too many so adding is not the solution.
Try this --
SELECT *
FROM LocalEntries
WHERE Not Exists
(SELECT * FROM ImportedEntries
WHERE ImportedEntries.StartDate = LocalEntries.StartDate
AND ImportedEntries.EndDate = LocalEntries.EndDate
AND ImportedEntries.Category = LocalEntries.Category
AND ImportedEntries.SubCat = LocalEntries.SubCat);
 
Whoops! Bad cutting and pasting on my part.

There are actually two extra )'s. Remove them from the second and the third
to last lines.

Sorry about that!
 
Back
Top