-2

Am trying to retrieve data from 3 tables at once but i am not sure how to do it in mysql (to be truthful i am really bad at database stuff so this confuse the hell out me).

1st logins table that has 3 columns id, email, password
2nd users table that has 4 columns id, name, surname, location_id
3rd locations has 3 columns location_id, country, city

what i want to do is write query using the users id to get the email from the logins table, then get name and surname from the users table. I then want to use the location_id i got from the users table to find out what city he or she is from.

i hope that makes sense to you and thanks for your time.

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
Newbie2016
  • 517
  • 3
  • 6
  • 11

1 Answers1

-1

maybe this could be helpful

select a.email, B.name, B.surname, C.city
from logings A join users B on (A.id=B.id) join locations C on 
Judith Palacios
  • 413
  • 2
  • 9