mysql - SQl update and select in one query -


I'm having a problem with a SQL query job.

The work is ongoing Product Prices: Product Products: Select as 'Product Id' prod_id, prod_name AS 'Product details', 'price of the product' as the value, on-house form In 'quantity', '% HP%'

like 'WHERE Prod_id'% TA% 'or' prod_id 'from supp_id AS' Product ID 'products is the second part of the work where I have a problem. I need to update prices up to 10% - I can do this with a different query. However, this is part of my college course and I am being asked to keep both updates and selections (showing changes) in a query. This is where I got stuck.

This is my code so far (I get an error in the part of the selection)

  Update products SET value = value + (value * 0.1) where 'product' Select '% HP' as the 'id' prod_id as' prod_id 'or' prod_id 'as prod_id' product details' as prod_name, value as' product value ', on_hand as' quantity 'Supp_id' from Supplier ID 'products where' prod_id '% TA%' or '% HP%' like 'prod_id'  

A MySQL statement (Ad Updated, select, delete, etc.) will end up with you it to end the semi-colon (;). If you add after the update, then it should work for you.

As a side note, I have never been told why people want to do two things in the same statement, but this is a whole other question and debate.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -