Jump to content

Need a SQL sentence to update database


Recommended Posts

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.

post-167748-0-24722000-1314718659_thumb.jpg

post-167748-0-50253000-1314720557_thumb.jpg

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...