Hi
Create table statements and insert statements will help immensely.
check if thid sql does what you want play with it then you can wrap it in a stored proc
i have a hunch your questions is ambiguous.Code:select e.tier_id, e.salary, e.dept_id from( select e.dept_id, e,tier_id, e.salary, rank() over(partition by e.dept_id,e.tier_id) rank from employee e where dept_id=1) t where rank=2 from t
even with the formatting your question is not legible i am afraid




Reply With Quote