nob2b Posted August 30, 2011 Share Posted August 30, 2011 Hi All, I need a SQL sentence to update database Update target: Table: “ps_product” >> Field:"available_for_order" I just want to change all the value of the field "0" to "1" Is the following sentence correct? UPDATE `ps_product` SET `available_for_order`=1 Please help. Link to comment Share on other sites More sharing options...
nob2b Posted August 31, 2011 Author Share Posted August 31, 2011 ... Link to comment Share on other sites More sharing options...
phrasespot Posted September 2, 2011 Share Posted September 2, 2011 UPDATE `ps_product` SET `available_for_order`=1 If you prefixed you tables ps_ SQL statement you posted will work. If not, replace the ps_ with whatever you prefixed them with. Though in this case does not make any difference (as only available values for that column are 0 and 1) it is usually a good idea to always use a WHERE clause as well with an UPDATE statement so you do not clobber all rows by accident. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now