locked
Join two columns from two different tables where both the columns have partially similar data RRS feed

  • Question

  • I have two tables, [A] and [B]. I want to join both tables on the [City] column from table [A] and [Cities renown for] column from table [B].

    So the [City] column from table [A] looks like this.

    [City] 

    ______________

    Orlando

    New York  

    Los Angeles 

    and the [Cities renown for] column from table [B] looks like this.

    [Cities renown for] 

    _________________________________________________________

    New York_Status of Liberty

    Orlando_Disney World

    Los Angeles_Hollywood

    My tables have about ten thousand rows each and I want to match the columns based on the city names like Orlando = Orlando_Disney World

    So I have written my query like this.

    Select a.[City]

    from [A] as a

    inner join [B] as b

    on a.[City] = b.[Cities renown for]   

    where a.[City] = b.[Cities renown for]   

    I know I am doing the last two lines wrong but don't know really how to fix it


    • Edited by tkhan17 Wednesday, July 18, 2018 7:33 PM
    Wednesday, July 18, 2018 7:18 PM

Answers

All replies