Home Forums Database Design Relational Theory Possible Join of One Table Field to Two Master Table Fields? RE: Possible Join of One Table Field to Two Master Table Fields?

  • Liam, you need to join the states table twice:

    SELECT m.member, h.HomeState, m.WorkState

    FROM master m

    LEFT JOIN States h ON h.[ID] = m.HomeState

    LEFT JOIN States w ON w.[ID] = m.WorkState

    Cheers

    ChrisM

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden