papaface Posted January 13, 2007 Share Posted January 13, 2007 Hello,How would I go about setting all the values in a given column to 0 using mysql?e.g. I have 30 rows of records with 7 colums. I would like to set all the current values in column 4 and 5 to 0regards Quote Link to comment Share on other sites More sharing options...
MCP Posted January 13, 2007 Share Posted January 13, 2007 update table set col4=0, col5=0 Quote Link to comment Share on other sites More sharing options...
scotmcc Posted January 13, 2007 Share Posted January 13, 2007 If you don't set a 'WHERE' clause on a SQL statement it should update all of the rows in the table. For example:[code]UPDATE [TABLE] SET [COLUMN1] = 0, [COLUMN2] = 0;[/code] Quote Link to comment Share on other sites More sharing options...
papaface Posted January 13, 2007 Author Share Posted January 13, 2007 Thanks :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.