MySQL Understanding Basic Joins

前端 未结 6 1753
借酒劲吻你
借酒劲吻你 2021-01-06 20:57

I am struggling to understand basic MySQL joins.

Basically I\'ve got 2 tables one with a customer first name and address id in it and another with the actual address.

6条回答
  •  天涯浪人
    2021-01-06 21:53

    Put the same 'addressid' in both the name and address tables then join the two as:

    select name, address from customer join addresses 
    on customer.addressid = addresses.addressid;
    

提交回复
热议问题