日期:2014-05-17 浏览次数:21291 次
SELECT 入库单.id, ta.name, tb.name FROM 入库单
JOIN
员工 AS ta WHERE 入库单.操作员 = ta.id
JOIN
员工 AS tb WHERE 入库单.业务员 = tb.id
SELECT 入库单.id, ta.name, tb.name FROM 入库单
JOIN
员工 AS ta ON 入库单.操作员 = ta.id
JOIN
员工 AS tb ON 入库单.业务员 = tb.id
create view [视图名]
as
select a.id,
b.name '操作员',
c.name '业务员'
from 入库单 a
left join 员工 b on a.操作员=b.id
left join 员工 c on a.业务员=c.id