SQL-关联表查询(连表查询)
0、例如:select * from T1,T2 where T1.a=T2.a
1、连表查询 <=> join(inner join)内连接查询
数据源:
Persion表:
Orders表:
//使用连表查询
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons,Orders
WHERE Persons.Id_P = Orders.Id_P
//使用join查询
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
INNER JOIN Orders
ON Persons.Id_P = Orders.Id_P
ORDER BY Persons.LastName
结果:
生活其实也很简单,喜欢的就去争取、得到的就珍惜、失去的就忘记。