accessing two rows at a time and compare them
421393Sep 3 2007 — edited Sep 3 2007i am using oracle 10G release 2, i have table structure like this
table_name(trans_date, current_bal1, current_bal2, current_bal3, prev_bal1, prev_bal2, prev_bale3)
except trans_date all fields are number and trans_date is date field.
I have data as following
01-aug-2007 100, 200, 300, null, null, null
02-aug-2007 400, 500, 600, 100, 200, 300
03-aug-2007 250, 600, 300, 400, 500, 600
07-aug-2007 150, 270, 350, 250, 600, 300
11-aug-2007 220, 500, 700, 150, 270, 350
---------------------------------------------------------------
12-aug-2007 800, 950, 330, 220, 500, 105
---------------------------------------------------------------
15-aug-2007 900, 650, 300, 800, 950, 330
if you are watching the record of 12th august
previous balances prev_bal1, prev_bal2, prev_bale3
does not match their respective records of 11th august i.e
current_bal1, current_bal2, current_bal3 of 11th august.
Problem is i am unable to understand that how can i access these two records at a time to compare. Actually i want to reconcile these data. If you people can help me i will be very grateful to you.
Regards