June 18, 2004 at 6:49 am
Hi all,
I need to update the table that require a field column from the previous row. eg.
field1, field2, field3
1,Text, NULL
2,Null, Num
3, Text, Null
4,Null, Num
I need the field2 values move to the next row field2. eg..
field1, field2, field3
2, Text, Num
4,Text,Num
thanks
June 18, 2004 at 7:12 am
update a
set a.field2 = b.field2
from tablea a
inner join tablea b
on b.field1 = a.field - 1
where a.field2 is null
Far away is close at hand in the images of elsewhere.
Anon.
June 21, 2004 at 10:16 am
Hi David,
I try your post and get an get the following syntax error: Syntax error converting the nvarchar value ' ' to a column of data type int. If seem to compute the following, b.field1 = a.field - 1 , instead of minus the field row.
thanks
June 21, 2004 at 10:36 am
on b.field1 = a.field - 1
should have been
on b.field1 = a.field1 - 1
If field1 is not int then you will have to cast the column to the correct data type
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy