What is a crosswalk table?

Crosswalk table a is a reference table which gets all the columns from two or more different tables.

Table1
ID   | Name     | Address     | Zip   | PhoneNumber
-----------------------------------------------------
IN11 | Brad Bob | 763 Park St | 25896 | 999-789-1234
-----------------------------------------------------

Table2
ID   | Name     | Address     | Zip   | PhoneNumber
-----------------------------------------------------
IN22 | Brad Bob | 763 Park St | 25896 | 999-789-1234
-----------------------------------------------------


Sample Crosswalk
Table1ID | Table2ID
---------------------
IN11     | IN22
---------------------

Query to get the Crosswalk:
SELECT Table1.ID AS Table1ID, Table2.ID AS Table2ID
FROM Table1
INNER JOIN Table2 ON Table1.Name = Table2.Name
  AND Table1.Address = Table2.Address
  AND Table1.Zip = Table2.Zip
  AND Table1.PhoneNumber = Table2.PhoneNumber

No comments:

Post a Comment