Home > other >  Mysql - used in the SELECT button, how to get a table from another name?
Mysql - used in the SELECT button, how to get a table from another name?

Time:05-22

I know this might be a simple question, but I always feel confused in the past one hour, and not sure you want to find which terms can accurately describe what I want to do things.
I have a MySQL database with two tables. Countries and Regions. The Regions table has two columns, id and name. 1 is an example of North America.
In the "country/region" in the table, there is a column called RegionID, if the country/region area in North America, it is classified as 1.
How to grab "North America" in the query not print out the "1"?
This is my incredible SELECT:

The SELECT A.n ame, A.r egionID FROM countries A and B regions ORDER BY A.n ame ASC

CodePudding user response:


The SELECT A.n ame, A.r egionID, b.N ame
The FROM countries A
The Join regions B
On B.i d=A.R egionId
The ORDER BY A.n ame ASC

CodePudding user response:

reference 1st floor response:
SELECT A.n ame, A.r egionID, b.N ame
The FROM countries A
The Join regions B
On B.i d=A.R egionId
The ORDER BY A.n ame ASC
good
  • Related