我在表格中有5列
using System;
namespace RijndaelAlgorithm {
public class Menu {
private CryptDecrypt r;
public Menu() {
r = new CryptDecrypt("123654");
}
public void showMenu() {
Console.WriteLine("the encrypted message is: " + r.encryptMsg("isjustatest"));
}
}
}
importcode
dateoftermination
hiredate
companyid
每个在不同公司工作的员工。
对于在不同公司ID中工作的每个员工ID。我需要获取具有employeeid
作为dateoftermination
和null
作为最新记录的记录的导入代码,以便与具有相同导入代码的其他hiredate
员工进行比较被显示而其他被忽略。
需要对每个员工ID进行上述过程。您能为此提供SQL查询吗?
这是我使用过的查询
companyid
但是我没有得到正确的结果。
这是Microsoft sql服务器
答案 0 :(得分:0)
您需要仅使用companyid或导入代码来使用group by,因为您想要相同的导入代码,但所有公司之间的最大雇用人数
select eeceeid,
max(eecDateOfLastHire) as maxDate
from EmpDetails
where eecDateOfTermination is null
group by eeceeid