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 Link to comment https://forums.phpfreaks.com/topic/34049-reset-all-column-values-to-0/ Share on other sites More sharing options...
MCP Posted January 13, 2007 Share Posted January 13, 2007 update table set col4=0, col5=0 Link to comment https://forums.phpfreaks.com/topic/34049-reset-all-column-values-to-0/#findComment-160068 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] Link to comment https://forums.phpfreaks.com/topic/34049-reset-all-column-values-to-0/#findComment-160069 Share on other sites More sharing options...
papaface Posted January 13, 2007 Author Share Posted January 13, 2007 Thanks :) Link to comment https://forums.phpfreaks.com/topic/34049-reset-all-column-values-to-0/#findComment-160075 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.