Multiple Conditions across 4 fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Hibbard
    New Member
    • Oct 2011
    • 1

    Multiple Conditions across 4 fields

    I admit I am a lightweight and I am still using Access 2000, but I hope that means you will know the answer to this question.
    I have two tables (one older) with traffic sign information. They each have 8 fields. I want to do something like a Many to Many when 4 other fields are equivalent. In other words, when the MAIN STREET, FROM STREET, TO STREET and SIDE OF STREET fields are the same in both tables, I want to have the SIGN (description) fields next to each other to see the changes. Sometimes the SIGN (description) field will be longer on the one Table, sometimes on the other Table.

    The data is something like this: you are driving down a street. The MAIN street is the one you are driving on. The FROM is the one you just passed. The TO is the one coming up. And the SOS is the left or right (or N,S,E,W) that you are looking at for signs. The SIGNs are a standard database and the descriptions are consistent even if they are sometimes cut off.

    Basically, I want to see the changes on the same block and side of the street between the 2 tables. I think I need some kind of where MAIN STREET = MAIN STREET, FROM STREET = FROM STREET, etc. conditions are met but, I am at a loss.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32645

    #2
    Try something like the following in a Query (See Extracting/Updating SQL from a QueryDef for how to use SQL in a query) :
    Code:
    SELECT tO.Main
         , tO.From
         , tO.To
         , tO.SoS
         , tO.Sign AS [OldSign]
         , tN.Sign AS [NewSign]
    FROM   [Older] AS [tO]
           INNER JOIN
           [Newer] AS [tN]
      ON   (tO.Main = tN.Main)
     AND   (tO.From = tN.From)
     AND   (tO.To = tN.To)
     AND   (tO.SOS = tN.SoS)

    Comment

    Working...