Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL question

SQL question

From: mpal <mpalkoci_at_yahoo.com>
Date: 25 Dec 2006 12:03:16 -0800
Message-ID: <1167076996.786212.291890@48g2000cwx.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US