我如何从表中检索数据

时间:2016-03-16 16:17:52

标签: mysql sql mysqli phpmyadmin

我的数据库中有这两个表。

表1:

enter image description here

表2:

enter image description here

如何编写sql查询从table1中检索id = 201102887的所有数据,这是在table2中写的

1 个答案:

答案 0 :(得分:0)

一个简单的JOIN即可。

select table1.*
from table1 inner join table2 ON table1.title = table2.major
where table2.id = 201102887