The subquery retrieves only those cate_ids from purchase table if their corresponding receive_qty is more than 10.
Updating My SQL Table using PHP Script You can update My SQL table data (using UPDATE command) through a PHP script.
My SQL UPDATE with WHERE My SQL UPDATE command can be used with WHERE clause to filter (against certain conditions) which rows will be updated.
The following My SQL statement will update the 'receive_qty' column of newpurchase table with a new value 25 if the value of purch_price is more than 50.
Another thing it won’t do is allow a query to refer to a temporary table more than once.
The My SQL manual mentions this at the bottom of the UPDATE documentation: “Currently, you cannot update a table and select from the same table in a subquery.” It’s pretty easy to work around the problem in this contrived example, but there are times when it’s not possible to write the query without subqueries that refer to the update target. Since My SQL materializes subqueries in the clause (“derived tables”) as temporary tables, wrapping the subquery into another inner subquery in the FROM clause causes it to be executed and stored into a temporary table, then referenced implicitly in the outer subquery.If an update on a row would result in a violation of a primary key or unique index, the update on that row is not performed. If you omit the WHERE clause, all records in the table will be updated!Where column_name is the name of the column to be updated and new_value is the new value with which the column will be updated.The following My SQL statement will update receive_qty, pub_lang, and receive_dt columns with new values 20, Hindi and 2008-07-10 if purch_price is more than 50.My SQL UPDATE with subqueries Here in the following, we have discussed how to use My SQL UPDATE command with subqueries.