create table Employee(
empId number(20) not null primary key,
empName varchar2(20) not null ,
deptName varchar2(12) ,
email varchar2(50)
)
create table Attend(
attentdId number(20) not null primary key,
empId number(20) not null ,
attendTime Date not null ,
status varchar2(4)
)
--对 考勤情况进行查询
select t.empname ,t.status , 次数 from ( select max(e.empname) empname , a.status status ,count(*) 次数 from Employee e left join attend a on e.empid =a.empid
group by a.status ) t order by t.empname desc
注意 对最后的结果集进行order by!!!!!