本文介绍了如何解决要求“最多"的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要写一个查询来选择雇用大多数员工的年份,该年份以及员工人数.我该怎么做?

I need to write a query to select the year in which most of the employees were hired, that year and the number of employees. How do i do this?

推荐答案

SELECT
     Year(EmployeeStartDate) AS YearHired, COUNT(EmployeeId) AS EmployeeHiredCount
FROM
    EmployeeDetails
GROUP BY
    Year(EmployeeStartDate)
ORDER BY
    Count(EmployeeID) DESC




假设您有一个包含员工详细信息的表并始终记录其开始日期,则可以使用YEAR函数对该字段进行分组和计数.看看您是否能找到如何选择自己感兴趣的记录.




Assuming you''ve got a table with Employee details and always record their start date, you can use the YEAR function to group and count by that field. See if you can figure out how to select the record you''re interested in.


这篇关于如何解决要求“最多"的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 23:53