hi
the following is the table struncture and insert statements
create table emp_trans values (empno number , emptran_no number, prev_amount number, current_amount number)
insert into emp_trans values(102,109,0,20);
insert into emp_trans values(102,119,10,20);
insert into emp_trans values(102,129,20,30);
insert into emp_trans values(102,139,30,0);
insert into emp_trans values(201,101,0,20);
insert into emp_trans values(201,110,20,30);
insert into emp_trans values(201,120,0,30);
insert into emp_trans values(201,130,30,20);
insert into emp_trans values(201,140,0,20);
In the table we can see some mappings as follows
The data is on empno basis.
we have 2 employees with empno 201 and 102 . Each empno has different emptrans_no. Need not be in an sequence.
we need to select the set of records where prev_amount column matches with the current_amount column values for
the previous record for every individual empno.
prior to that the following basic select statement can be considered
select * from emp_trans order by empno , emptran_no
for ex:
emp no 102 emptran_no 129 prev_amount column having values of 20 matches with the current_amount column having values 20
with emptran_no 119.
for empno 201 with emptran_no 110 we can see the prev_amount column having value 20 matched with current_account column havig values of 20
of previous emptran_no 101 for the same empno 201.
something like we need to see the diagnally mathced values.
Any help on such query most welcome.
Regards,