Subject RE: [firebird-support] read the next record of the table
Author Svein Erling Tysvær
What you do should work. The one thing I would expect to cause this to fail, is if you didn't commit the transaction. Another things that could be of influence, is the field type of row_id, if it is an integer, decimal or date (provided dialect 3) field, I cannot see how this could fail. Floating point numbers is something completely different, they're approximate (may be 1.00000000232 when you think it is just 1) and shouldn't be used with comparison for equality. Of course, if field_a and field_b is incompatible field types, then you would also get trouble, but that would normally be very visible for you when you try to prepare the statement.

With integers, I've done similar things (though I cannot remember having done exactly the same) lots of times with Firebird 1.5.


-----Original Message-----
From: [] On Behalf Of Maurizio
Sent: 13. juni 2008 12:40
Subject: [firebird-support] read the next record of the table

hi ,
ho can i update a field with the value of another field
positioned in the next row , example :

row_id | field_a | field_b
1 11
2 22
3 33
4 44

table should be :

row_id | field_a | field_b
1 11 22
2 22 33
3 33 44
4 44 null

i tryed :

UPDATE myTable m
SET m.field_b =
SELECT m2.field_a
from myTable m2
where m2.row_id = m.row_id + 1

it doesn't work : all field_b values are null