Search code examples
sqloracleoracle19clead

How do we remove the column that is created by LEAD function


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

enter image description here

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 ?


Solution

  • You should specify the columns you need.

    You can either get all fields (*) or specify the fields you want.

    More info