【发布时间】:2014-05-01 05:55:51
【问题描述】:
我的表每年每个员工都有一条记录。如何为每位员工选择一条记录以获得该员工的最近一年?
列是employee_ref, firstname, lastname, employment_year。
每个employee_ref都会有几条记录,每条记录都有不同的employment_year值
我想为每个employee_ref 选择一条记录,其中employment_year 具有该employee_ref 的最高值,并显示该记录中的firstname 和lastname。
虽然我懂 SQL,但我的技能还达不到这一点。
【问题讨论】:
-
您使用的是什么数据库? SQL Server、mySQL、Postgress 等?
-
这种情况下没关系。
标签: sql