Hi Gurus,

Please forgive this naive question:

Say, I have a table (containerId, itemId) where for each containerId there are several rows (different itemId value) in that table. Now I want to give those rows (with same containerId) a sequence, so add one colum there to make it become (containerId, itemId, sequence); how do I make such changes through SQL?

I know how to alter the table to insert that new column, but how do I populate the existed rows on that new column? note the sequence dose not need to confirm to any sorting of other columns, i.e., as long as there is a sequence is ok. for example, if I already have :

containerId  | itemId  |
1                     1001
1                     1002
1                     1003
2                     2001
2                     2002

then either

containerId  | itemId  |  sequence
1                     1001         0
1                     1002         1
1                     1003         2
2                     2001         1
2                     2002         0

or

containerId  | itemId  |  sequence
1                     1001         2
1                     1002         1
1                     1003         0
2                     2001         0
2                     2002         1

are all OK.

Thanks,
Gnale

_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfeeŽ Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster

Reply via email to