Query to compare old to new table

  • Thread starter Thread starter joseph_f_bruce
  • Start date Start date
J

joseph_f_bruce

I have 2 tables. One old with User ID's and desk locations. I want
to show only the users who's desk location has changed. Any ideas?
 
For the sake of argument, let's assuming they're named Table1 and Table2,
and that both have fields named UserID and DeskLocation.

You'd need a query that has SQL like:

SELECT Table1.UserID, Table1.DeskLocation, Table2.DeskLocation
FROM Table1 INNER JOIN Table2
ON Table1.UserID = Table2.UserID
WHERE Table1.DeskLocation <> Table2.DeskLocation

To create a query that generates that through the query builder, you'd
select Table1 and Table2 to be in the query.

Once you have them, if there isn't already a line joining the two tables,
you'd drag the UserID field from Table1 and drop it on the UserID field in
Table2.

You'd drag the UserID and DeskLocation fields from Table1 into the grid, and
drag the DeskLocation field from Table2 into the grid.

In the Criteria row underneath the DeskLocation field for Table1 in the
grid, you'd type

<> [Table2].[DeskLocation]
 
Back
Top