简体   繁体   中英

How to choose a value from another table using a JOIN

I just want to know one SQL query.

I've got two tables:

id | id_town
1  | 26



id | town
26 | Prague

What's the query if I need to print "Prague"? Thank you.

PhpMyAdmin prints #1052 - Column 'id' in on clause is ambiguous

I tried this

SELECT town FROM localities JOIN towns ON id = id_town

TRY THIS:

select b.town
from table1 a
inner join table2 b on a.id_town = b.id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM