Answer the question
In order to leave comments, you need to log in
How to make sql query from four tables?
Bottom line: select all users -> take all data from the user -> select a city whose id is equal to city_id in the user table -> select the names of cities, regions and countries -> ids of countries and regions are indicated in the city table. Below, I kind of wrote about it, but I want it in one request.
SELECT * FROM users
SELECT name FROM city WHERE user.city_id = city
SELECT name FROM region WHERE city.region_id = region_id
SELECT name FROM country WHERE city.country_id = country_id
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question