Comparing Rows Hi,
The only way I can think of to do this is to create a cursor and
somehow loop through the rows, comparing each column, and sum the
totals. Does anyone know a more straightforward, easier way to
accomplish?
I have a table where I have compare each column to see if something has
changed for the same part. If so, the changes must be counted before
or after a certain level - thereby, splitting the counts into 2
categories. I am using Oracle 9.2.0.3.0 on AIX platform.
The data is as follows. I need to determine how many iterations the
part has gone through. A change made on any layer below 8 goes into
category cnt 1, above 8 is catg2 cnt.
Part# Lvl# Layer Rev
----- ---- ----- ---
7239 9032 1 A 1st entry of part
7239 9032 2 A
7239 9032 3 A
7239 9032 3.9 A
7239 9032 4 A
7239 9032 4.5 A
7239 9032 5 A
7239 9032 6 A
7239 9032 6.05 A
7239 9032 7.1 A
7239 9032 8 A
7239 9032 9 A
7239 9032 10 A
7239 9032 11 A
7239 9032 12 A
7239 9032 13 A
7239 9032 15 A
7239 9032 30 A
7239 9199 1 A compare to previous row for
7239 9199 2 A same part, so this is rev 1
7239 9199 3 A
7239 9199 3.9 A
7239 9199 4 A
7239 9199 4.5 A
7239 9199 5 A
7239 9199 6 A
7239 9199 6.05 A
7239 9199 7.1 B Change occurred below layer 8
7239 9199 8 B Catg1 cnt = 1; catg2 cnt=0;
7239 9199 9 B
7239 9199 10 B
7239 9199 11 B
7239 9199 12 B
7239 9199 13 A
7239 9199 15 B
7239 9199 30 A
7239 9517 1 A
7239 9517 2 A
7239 9517 3 A
7239 9517 3.9 A
7239 9517 4 A
7239 9517 4.5 A
7239 9517 5 A
7239 9517 6 A
7239 9517 6.05 A
7239 9517 7.1 B
7239 9517 8 C Change occurred above 8+ layer
7239 9517 9 C catg1 cnt=1; catg2 cnt=1;
7239 9517 10 C
7239 9517 11 A
7239 9517 12 C
7239 9517 13 A
7239 9517 15 A
7239 9517 30 B
7239 10008 1 A
7239 10008 2 A
7239 10008 3 A
7239 10008 3.9 A
7239 10008 4 A
7239 10008 4.5 A
7239 10008 5 A
7239 10008 6 A
7239 10008 6.05 A
7239 10008 7.1 B
7239 10008 8 C Change occurred above 8+ layer
7239 10008 9 C Catg1 cnt = 1; catg2 cnt=2;
7239 10008 10 D
7239 10008 11 B
7239 10008 12 C
7239 10008 13 A
7239 10008 15 B
7239 10008 30 B |