Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent help needed, difference between two tables? 1

Status
Not open for further replies.

Ayac

Programmer
Nov 10, 2000
141
HU
Hi all!

Do you know how to get the difference as a result of two tables? I have two calendar tables in Access (both have the same data structure), one from last week and one from today. I would like to create a query that returns only those lines what are different between the two.
 
Thanks you all for trying to help and giving some ideas. Finally this is what really worked:

'strQuery3 = "SELECT [ID] & CStr([TILLDATETIME]) & CStr([fromdatetime]) & [title] & CStr([holdback]) & [cidentifier] & [connectioncode] & [details] AS Expr1, ID, FromDateTime, TillDateTime, Holdback, CIdentifier, ConnectionCode, Title, Details, 'New' AS DType"
'strQuery3 = strQuery3 & " FROM " & CompareCal
'strQuery3 = strQuery3 & " WHERE ((([ID] & CStr([TILLDATETIME]) & CStr([fromdatetime]) & [title] & CStr([holdback]) & [cidentifier] & [connectioncode] & [details]) Not In (select [ID] & CStr([TILLDATETIME]) & CStr([fromdatetime]) & [title] & CStr([holdback]) & [cidentifier] & [connectioncode] & [details] from " & NewCalendar & ")))"
'strQuery3 = strQuery3 & " Union "
'strQuery3 = strQuery3 & "SELECT [ID] & CStr([TILLDATETIME]) & CStr([fromdatetime]) & [title] & CStr([holdback]) & [cidentifier] & [connectioncode] & [details] AS Expr1, ID, FromDateTime, TillDateTime, Holdback, CIdentifier, ConnectionCode, Title, Details, 'Old' AS DType"
'strQuery3 = strQuery3 & " FROM " & NewCalendar
'strQuery3 = strQuery3 & " WHERE ((([ID] & CStr([TILLDATETIME]) & CStr([fromdatetime]) & [title] & CStr([holdback]) & [cidentifier] & [connectioncode] & [details]) Not In (select [ID] & CStr([TILLDATETIME]) & CStr([fromdatetime]) & [title] & CStr([holdback]) & [cidentifier] & [connectioncode] & [details] from " & CompareCal & ")))"
'strQuery3 = strQuery3 & " ORDER BY FromDateTime, ID, DType"
 
It looks a little messy (just leave the 'strQuery3 = strQuery3 & parts, those are from ASP), but shows both the deleted, added and the modified records in a query without creating a new table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top