Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use LEAD function??

868814Jul 5 2011 — edited Jul 6 2011
hello everyone,

i am new at this; i know only some basic "select" statements like, "select column1, column1, etc. when column1='***' etc...
Today i ran into a more complicated select, and i can't figure it out. Please help. btw, i tried the "LEAD" function but results is not working as i wanted.

I have an EMPLOYEE table of the followings. what i want to 'select' is, if the employee name of the next record is equal to the previous record, then put the TITLE of the next record into a new column(see sample results under "RESULTS") section, AND list results of only those records that the "TITLE" does not equal to "NEW-COLUMN"

thank you.
Joe

_EMPLOYEE TABLE_

NAME TITLE
joe clerk1
joe clerk2
john nurse1
john nurse2
john wilson nurse3


_RESULTS_

NAME TITLE NEW-COLUMN
joe clerk1 clerk2
john nurse1 nurse2
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 3 2011
Added on Jul 5 2011
10 comments
348 views