【发布时间】:2011-06-28 21:32:23
【问题描述】:
我实际上是在尝试获取每个员工当前职位的结果集。我想从中创建一个视图以供以后使用,但我发现我被难住了,并且可能缺少一个简单的解决方案。这是有问题的查询,提前致谢!
select * from
(SELECT
appointment.employee_id,
title.`name` as title_name
FROM
appointment
INNER JOIN appointment_title ON appointment.id = appointment_title.appointment_id
INNER JOIN title ON appointment_title.title_id = title.id
order by appointment_title.effective_date DESC) tmp group by employee_id
【问题讨论】: