作者yzfr6 (白子都胡啦!)
看板Web_Design
标题Re: [问题] MySQL关联语法问题?
时间Wed Apr 12 12:20:39 2006
※ 引述《forkome (乌龟)》之铭言:
: 部门
: ==========================
: table名称 dept
: 栏位名称 deptId
: deptName
: 职称
: ==========================
: table名称 position
: 栏位名称 positionId
: positionName
: 使用者
: ==========================
: table名称 user
: 栏位名称 userId
: userName
: userDept <===关联部门
: userPosition <===关联职称
: 小弟现在只会关联一个 select * from user join dept on userDept = deptId
: 若想要user和dept、position在一次查询中关联起来,该如何下指令呢?
: 先谢了
select *
from user
inner join dept on userDept = deptID
inner join position on userPosition = pisotionID
where (你要的条件)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 211.22.72.201
1F:→ forkome:感谢!小弟现在去试看看 04/13 00:00