Subject | read the next record of the table |
---|---|
Author | Maurizio |
Post date | 2008-06-13T10:39:40Z |
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
thanks
Mauro
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
thanks
Mauro