I have searched others' code and tried to customize in my case, but it seemed when the question was the "max", it worked. When it comes to find the top 100, it was not working. I am trying to get the first 100 people hired in the firm. I first tried TOP(100) and then RANK(), I guess they would both work. I was not super familiar with the syntax though. I wonder would anyone could kindly provide me with any suggestion on my code?
Thank you very much!
SELECT d.department_name, d.department_id, e.first_name, e.hire_date, e.salary
from Dtable_department d join
Etable_employee e
on e.department_id = d.department_id
where hire_date = (select DENSE_RANK() OVER (PARTITION BY e.hire_date ORDER BY hire_date DESC) AS E_RANK_hire WHERE rownum=100))
Group BY E_RANK_hire
order by E_RANK_hire