| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL Addition
ok so ive got my sql script al lrinnign fin but i needto make batch updates to a set of rows
UPDATE `cmsquizanswers` SET `QUID` = '42' WHERE `QUID` = '43' AND `MOID` = '46' ; that wprks fine for changing all items tha t were 43 and 46 to 42 and 46 but i also need to chang e a 3rd field OrderS for eash of refernece here are the collum names QQID, QUID, MOID, question, answer, orderS now for Order S they are set goign in a order of 10, 20, 30, etc per row andi want to change them to 110, 120, 130, is they some way i can say do a "orderS +100" for all values inside the where range in the order S colum
__________________
24y-CW, 8y-HTML, 5y-PS, 8m-PHP And I never knew Photoshop could do HTML! You learn something every day. http://lexxboard.lurkerlordx.com/listcatagories.php |
|
#2
|
|||
|
|||
|
Sure, you'd do it just the same way.. not sure what you where logic is going to be, so i'll just make something up:
Code:
update orders set order_num = (order_num + 100) where order_num in (10,20,30) |
|
#3
|
|||
|
|||
|
would
Code:
UPDATE `cmsquizquestion` SET `OrderS` = = (OrderS + 100) WHERE `QUID` = '45' AND `MOID` = '47' ; work? |
|
#4
|
|||
|
|||
|
yep, but you have 2 equal signs in there, you just need 1, not sure if you miss-typed (which you seem to always do
Kurt |
|
#5
|
|||
|
|||
|
I am arguallby credited as the internet's Typo King...
|
|
#6
|
|||
|
|||
|
Now there's a custom rank for you!
__________________
http://root32.com - General computing. (network links also) |
![]() |
| Viewing: Tutorialized Forums > Databases > SQL Basics > SQL Addition |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|