Active8 years, 10 months ago
MySQL UPDATE vs INSERT and DELETE. Ask Question. PHP MySQL Update Function not working. INSERT SELECT ON DUPLICATE KEY: Has an insert been made or an update? This is a simple Add, Update, Delete and Search using PHP and MySql. Only for first class of PHP -Connect to Database with MySQl -Insert -Update -Delete -Search all of Using HTML, CSS and PHP Only. Mysql: select, insert, delete and update in one query. Ask Question. Insert into a MySQL table or update if exists. SQL select only rows with max value on a. Basic insert, view, edit, delete and update using PHP and Mysql Hi readers, today i going to post one of old topic in php and mysql, here i'm going to post Insert data through form, and fetch / view the data from database, and also Edit, Delete and Update with detailed explanation.
Add Edit Update Delete Using Php and Mysql Posted in PHP by Praveen Crony On June 4, 2014. 1 Comment Hi Guys, Every web programming language have database operations.
i need in one query use select, insert, delete and update.
(I need copy data from old table in to new, then delete old, and update another).
Insert and select (copy function I was able to, but now i have problem)
I have this query:
Thanks
user319854user3198541,6351010 gold badges3535 silver badges4343 bronze badges
4 Answers
You can't do it all in one query, but you can do it all in one transaction if you are using a transactional store engine (like InnoDB). This might be what you want, but it's hard to tell only using the information you provided in your question.
Ike WalkerIke Walker51.7k1313 gold badges8585 silver badges9494 bronze badges
MySQL
does not support MERGE
, so you'll have to do it in two queries:, provided you have
QuassnoiQuassnoiPRIMARY KEY (id)
in both tables.345k7373 gold badges542542 silver badges567567 bronze badges
In one query i dont think its possible.
You can try writing a Stored Procedure and using Triggers you may achieve that
zodzod7,9862222 gold badges5959 silver badges9999 bronze badges
You can't combine Select/Update/etc into one query. You will have to write separate queries for each operation you intend to complete.
pinkfloydx33pinkfloydx334,34733 gold badges2727 silver badges4545 bronze badges