sql server 三表查询

一.首先要建立三个表

1.hanshu

2.YingHu

3.YYsex

二.建立关系图

--查询条件hanshu中的name 和 YingHu中的YYsex 和 text中的age

select hanshu.name,YingHu.YYsex,text.age from hanshu,YingHu,text
where YingHu.id=hanshu.id --where/关联三个表
AND YingHu.id=text.id

猜你喜欢

转载自www.cnblogs.com/tangtangsimida/p/9545050.html