SSH中hibernate查询
如何根据员工查询员工所在部门经理的信息
------解决方案--------------------
select * from sys_employee t where t.sn in (
select t1.manager_sn from sys_department t1 where t1.ID = (
select t2.department_id from sys_employee t2 where t2.sn = 要查询的员工编号
)
)
------解决方案--------------------
select dep.manager_sn from sys_department dep where dep.id = (
select emp.department_id from sys_employee emp where emp.sn = '查询的员工号'
)
如果用hibernate的话,映射是一(部门)对多(员工)的映射关系