I have two tables:
base_profile: id, first_name, last_name, address
flight_profile: id, flight_no, destination
How do i select all fields from these two tables based on the same id? My assumption would be :
SELECT *
FROM base_profile, flight_profile WHEN base_profile.id == flight_profile.id
WHERE id, first_name,last_name,address,flight_no,destination
I know this is not right. Can anyone help me to correct it please? Thanks.
Using an inner join
SELECT base_profile.id, base_profile.first_name, base_profile.last_name, base_profile.address,
flight_profile.flight_no,flight_profile.destination
FROM base_profile INNER JOIN flight_profile
ON base_profile.id = flight_profile.id
or more generally
SELECT <fields you want to return>
FROM <tables linked with joins>
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