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.
Rather than just displaying the customer name and an address id I want it to display the customer name and the actual address.
My basic select statement is like this:
SELECT firstName, addressId FROM Customer
It will display something like this:
firstName addressId
---------------------
Bob 56
Rather than than I would like to join the addressId with an actual address in another table
Like this:
firstName address
----------------------------------
Bob 45 Somewhere street
Is there anyone who can show me the best way to achieve this?
Also can anyone recommend a good tutorial for joins?
SELECT a.name, b.address
FROM Customer a INNER JOIN AddressList b on a.addressID = b.addressID
To learn more about joins, see the article below,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With