About 492,000 results
Open links in new tab
  1. MySQL - UPDATE query based on SELECT Query - Stack Overflow

    Follow here to know how to use this query http://www.voidtricks.com/mysql-inner-join-update/ or you can use select as subquery to do this. UPDATE [table_name] SET [column_name] = (SELECT [column_name] FROM [table_name] WHERE [column_name] = [value]) WHERE [column_name] = [value];

  2. How to Update Records in MySQL with a Select Query - Squash

    Nov 1, 2023 · To update a MySQL query based on a select query, you can use the UPDATE statement with a subquery. This allows you to update rows in one table based on the values returned from a select query on another table.

  3. mysql - SQL UPDATE statement from SELECT statement ... - Stack Overflow

    Dec 31, 2013 · An easy way to do this is create a SELECT statement to generate the UPDATE statements: SELECT CONCAT('UPDATE home_provider SET abbrv="', abbrv, '" WHERE id=', id, ';') FROM home_provider This will then give you: UPDATE home_provider SET abrv="ACA" WHERE id=1; UPDATE home_provider SET abrv="ALL" WHERE id=2; UPDATE home_provider SET abrv="ARK ...

  4. Update From Select in MySQL (How to Guide) - Five

    Jul 12, 2024 · This guide will walk you through the process of performing an update from a select statement in MySQL, providing detailed explanations, examples, and best practices to ensure you can use this technique effectively.

  5. MySQL - SELECT then UPDATE - Stack Overflow

    Just do the UPDATE when you SELECT it at the same time. Change this: to this: SELECT id, product_name, sku, qty . FROM supplier_dropship_items . WHERE supplier_id = '3' AND status = '2' This is assuming you have an ID column inside your table as this is how it should be set up and how any normalized table would look like.

  6. How to Update from Select in SQL - Database Star

    Jun 2, 2023 · Let’s take a look at the SQL Update from Select techniques in this guide. To update data in a table, we can run an UPDATE statement. The syntax of an update statement is this: You can specify one table and one or more pairs of columns and values. You can also specify a condition in the WHERE clause so that only matching rows are updated.

  7. MySQL :: MySQL 8.0 Reference Manual :: 15.2.17 UPDATE Statement

    UPDATE is a DML statement that modifies rows in a table. An UPDATE statement can start with a WITH clause to define common table expressions accessible within the UPDATE. See Section 15.2.20, “WITH (Common Table Expressions)”. Single-table syntax: {expr | DEFAULT} assignment: col_name = value assignment_list: assignment [, assignment] ...

  8. Using SQL UPDATE from SELECT statement [7 Methods]

    Aug 20, 2023 · Here are a list of possible methods to use UPDATE from SELECT in SQL: Subquery in SET Clause: Updates target columns using a subquery that returns a single value. This is useful when the updated value depends on some aggregate or computation from another table. UPDATE JOIN: Directly joins the table you want to update with a source table.

  9. MySQL 8: UPDATE on a SELECT query in multiple tables

    Jan 26, 2024 · In this guide, we will delve into how to perform an UPDATE using a SELECT query across multiple tables within MySQL 8. This powerful technique allows you to change records in one table based on values in other tables, combining data retrieval with …

  10. Using SELECT in the UPDATE Statement, MySQL - Özgür Özkök

    Sep 20, 2023 · Using SELECT statements or subqueries within an UPDATE clause in MySQL can significantly expand the versatility and dynamism of your SQL scripts. This allows you to create complex, condition-based updates, leveraging the power of SELECT statements and JOIN operations within your UPDATE clauses.

  11. Some results have been removed