When I run run below query
SELECT
*
FROM
(
SELECT
LEAD(hire_date)
OVER(PARTITION BY department_id
ORDER BY
hire_date
) AS recent_joinee,
a.*
FROM
employees a
)
WHERE
recent_joinee IS NULL;
I am getting below results
But i don't need the first column "Recent_joinee" as this is created by the lead function , Rest of "n" number of columns i need.
For this scenario what i need to do ?
You should specify the columns you need.
You can either get all fields (*) or specify the fields you want.