Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> SQL question
Hello everyone,
I need to write a query in SQL that returns specific records, I am not
sure how to approach it.
I was wondering if someone would have any suggestion.
Here is the situation.
Essentially, the table includes list of departments with number off
attributes.
Whenever there is a change in any of the attributes, new record with
new effective date is created.
The table includes the following records (illustrative sample):
DEPT EFF_DATE DESCRIPTION OTHER
0100 Apr 21 Education Dept xxx 0100 Apr 22 Education Dept yyy 0100 Apr 23 Education Dept zzz 0100 Apr 24 Education Department zzz 0100 May 1 Education Dept aaa 0100 May 2 Education Dept bbb 0200 Apr 1 Research Dept xxx 0200 Apr 2 Research & Dev xxx 0200 Apr 3 Research & Dev yyy 0200 Apr 4 Research & Development yyy 0200 Apr 5 Research Dept yyy
I need to write a query that will scan the table for each department in chronological order and select the records where the change occurred in the Description field.
The expected result from the previous table would be:
DEPT EFF_DATE DESCRIPTION OTHER
0100 Apr 21 Education Dept xxx 0100 Apr 24 Education Department zzz 0100 May 1 Education Dept aaa 0200 Apr 1 Research Dept xxx 0200 Apr 2 Research & Dev xxx 0200 Apr 4 Research & Development yyy 0200 Apr 5 Research Dept yyy
Any suggestions would be appreciated.
Thank you,
Milos Received on Mon Dec 25 2006 - 14:03:16 CST
![]() |
![]() |