SQL Basics
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old January 5th, 2005, 03:20 PM
LLX LLX is offline
Senior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Glendale, CA
Posts: 285 LLX New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to LLX Send a message via MSN to LLX
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

Reply With Quote
  #2  
Old January 5th, 2005, 04:46 PM
kurt kurt is offline
Administrator
Tutorialized Novice (500 - 999 posts)
 
Join Date: Jan 2004
Posts: 514 kurt New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 5 m 48 sec
Reputation Power: 0
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)

Reply With Quote
  #3  
Old January 5th, 2005, 05:36 PM
LLX LLX is offline
Senior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Glendale, CA
Posts: 285 LLX New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to LLX Send a message via MSN to LLX
would

Code:
UPDATE `cmsquizquestion` SET `OrderS` = = (OrderS + 100) WHERE `QUID` = '45' AND `MOID` = '47' ;


work?

Reply With Quote
  #4  
Old January 5th, 2005, 06:03 PM
kurt kurt is offline
Administrator
Tutorialized Novice (500 - 999 posts)
 
Join Date: Jan 2004
Posts: 514 kurt New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 5 m 48 sec
Reputation Power: 0
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 ) or not.

Kurt

Reply With Quote
  #5  
Old January 5th, 2005, 06:30 PM
LLX LLX is offline
Senior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Glendale, CA
Posts: 285 LLX New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to LLX Send a message via MSN to LLX
I am arguallby credited as the internet's Typo King...

Reply With Quote
  #6  
Old January 5th, 2005, 07:11 PM
Terencentanio Terencentanio is offline
Senior Member
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: England
Posts: 154 Terencentanio New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via MSN to Terencentanio
Now there's a custom rank for you!
__________________
http://root32.com - General computing. (network links also)

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > SQL Addition


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway