我需要有关基本 MySQL/SQL 相关问题的帮助。
我有 2 张 table :
表1
house_id | house address | house_type_id |
------------------------------------------
1 | John str. | 33
2 | Peter str. | 41
3 | Louis str. | 33
4 | Harold str. | 17
表2
house_type_id | house_type_description
--------------------------------------
33 | Big
41 | Medium
17 | Small
我想得到以下结果:
house_id | house address | house_type_id |
------------------------------------------
1 | John str. | Big
2 | Peter str. | Medium
3 | Louis str. | Big
4 | Harold str. | Small
我尝试以下语句,但它没有产生所需的输出:
SELECT * FROM Table1, Table2 Where Table1.house_type_id = Table2.house_type_id
你能帮我看看问题出在哪里吗?
最佳答案
尝试:
SELECT house_id , house address, house_type_description
FROM Table1 inner join Table2
on Table1.house_type_id = Table2.house_type_id
关于mysql - 基本 SELECT 查询 - 来自多个数据库的结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31233309/