November 28, 2007 at 2:13 am
Hi,
I have an query. I need to update the serial number for each group
i.e ex:
col1 col2
acc1 1
acc2 2
acc1 1
acc3 3
acc4 4
In the above example, acc1 is updated by 1 and acc2 by 2.....Col1 already has the data .only col2 should be updated based on the col1.
Could you provide the update script for this query?
November 28, 2007 at 2:31 am
try the following:
update
set col2 = right (col1, 1)
November 28, 2007 at 2:40 am
I think the above example misleads you....I will re-format the example. pls find below:-
col1 col2
a 1
b 2
a 1
c 3
d 4
I presume that above example would be sufficient. Can you provide the solution???
November 28, 2007 at 4:11 am
Assuming that you want alphabetical row numbering, here is what you can do...
UPDATE SomeTable SET Col2 = 66 - ASC( LOWER( Col1 ) )
--Ramesh
November 28, 2007 at 4:41 am
UPDATE SomeTable SET Col2 = 66 - ASCII( LOWER( Col1 ) )
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply