Oracle query and aggregate function

前端 未结 2 1105
余生分开走
余生分开走 2021-01-26 11:31

I have table name employee_1 suppose in oracle. If the mobile_no and sim_no is same i want select maximum start_date. I have tried , but no success. Please help The employee_1 t

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-26 12:20

    Try this, hopefully, it fulfills your requirement.

    select mobile_no,sim_no,start_date,end_date from(
    select mobile_no,sim_no,start_date,end_date,rank() over(partition by mobile_no,sim_no order by start_date desc) rn from employee_1)s
    where rn=1
    

提交回复
热议问题