作者idicivik ( 苦海钓叟)
看板Web_Design
标题Re: [问题] MySQL关联语法问题?
时间Wed Apr 12 09:19:19 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, dept, position on
(userDept = deptID and userPosition = positionName); (可能这样可以过)
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.50.171
1F:推 forkome:感谢!小弟已看到 04/12 23:59