Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> select problem
SELECT
NAME,rowid, MAX(PAYROLL_YEAR||', '||PAY_PERIOD||' ,'|| BASESAL ) FROM DAILYDBA.EMPINFO_AGENTS GROUP BY name, rowid; NAME ROWID
------------------------------ ------------------ -------------------------------------------------- AGANS, JAMES W AAAIjkACQAAABlAAAD 2001, 01 ,16.3 AGANS, JAMES W AAAIjkACQAAABlAAAG 2002, 01 ,17.3 JOHNSON, JOHN E AAAIjkACQAAABlAAAA 2002, 06 ,17.3 JOHNSON, JOHN E AAAIjkACQAAABlAAAC 2001, 18 ,16.3 JOHNSON, JOHN E AAAIjkACQAAABlAAAF 2002, 18 ,17.3 SMITH, STRAPPIN, STEVE AAAIjkACQAAABlAAAE 2001, 05 ,17.3 SMITH, STRAPPIN, STEVE AAAIjkACQAAABlAAAH 2002, 05 ,16.3
7 rows selected
hi...this is what I have but its not really what I want . Im afriad I ve reached an impasse.
What I need to do is get the latest PAYROLL_YEAR and PAY_PER for a given name. ex:
for AGANS, JAMES W has 2 recs. I need the one for this name that has
the 2002
in the PAYROLL_YEAR field and 01 in the PAY_PERIOD field . This is the
last record inserted for AGANS, JAMES W
for JOHNSON, JOHN E I need to get the record the one w/ 2002 PAYROLL_YEAR field and 06 PAY_PERIOD field. Once again the last inserted.
any help ???
by the way i need to put this in a cursor in order to update a field
in this table.
the field Ill call 'y' isnt in the sql yet ...I havent figured it out
that far.
thanks
jim Received on Mon Jun 10 2002 - 22:02:42 CDT
![]() |
![]() |