56,675
社区成员
发帖
与我相关
我的任务
分享
select * from casetable where case_time in (select min(case_time) from casetable group by idcard);
select * from casetable where case_time in (select min(case_time) from casetable group by idcard);
select a.*
from
casetalbe a,
(select idcard,case_type,case,min(case_date) as min_date from casetalbe group by idcard,case_type,case) b
where b.idcard=a.idcard and b.case_type=a.case_type and b.case=a.case and b.min_date=a.case_date);
select * from ttselect * from casetalbe a
where not exists (select 1 from casetalbe where idcard=a.idcard and case_date<a.case_date);
select a.* from casetalbe a
where not exists (select 1 from casetalbe b where b.idcard=a.idcard and b.case_type=a.case_type and b.case=a.case and b.case_date<a.case_date);