MySQL Query Help

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   MySQL Query Help
JRSweets
CZ Active Member
 Codezwiz Site Donator
JRSweets has been a member for over 20 year's 20 Year Member
usa.gif massachusetts.gif
Age: 43
Gender: Male
Fav. Sports Team: NE Patriots
Website:
Status: Offline
Joined: Apr 07, 2004
0.03 posts per day
Posts: 259
Points: 19,861
  MSN Messenger 
I need help. I am trying to write a mySQL query that will go thru a tables field and change every value of that field based on the original value. For example, say I had a table with the field "Status". "Status" will either equal 1 or 0. I want to be able to go thru that table and change every instance of 1 in the "Status" filed to 0.

Any ideas.

Is this valid.
UPDATE table_name SET Status = '0' WHERE Status = '1';



Back to top Reply with quote
#2   
aUsTiN
CZ Active Member
usa.gif georgia.gif
Age: 41
Gender: Male
Website:
Status: Offline
Joined: Sep 09, 2003
0.02 posts per day
Posts: 142
Points: 57
  MSN Messenger 
UPDATE table SET field = '0' WHERE field <> '0';

That will change anything & everything to a 0 that is not a 0.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum