About 351,000 results
Open links in new tab
  1. mysql - SQL - Update multiple records in one query - Stack Overflow

    Try either multi-table update syntax. ON t1.config_name = 'name1' AND t2.config_name = 'name2' SET t1.config_value = 'value', t2.config_value = 'value2'; Here is a SQLFiddle demo. or conditional update. SET config_value = CASE config_name . WHEN 'name1' THEN 'value' . WHEN 'name2' THEN 'value2' . ELSE config_value. END.

  2. sql - Multiple Updates in MySQL - Stack Overflow

    MySQL optionally allows having multiple statements in one statement string. Sending multiple statements at once reduces client-server round trips but requires special handling. Here is the result comparing to other 3 methods in update 30,000 raw.

  3. MySQL UPDATE Statement - W3Schools

    UPDATE Multiple Records. It is the WHERE clause that determines how many records will be updated. The following SQL statement will update the PostalCode to 00000 for all records where country is "Mexico":

  4. How To Update Multiple Columns in MySQL? - GeeksforGeeks

    Apr 8, 2024 · In this article, we will learn how to update multiple columns in MySQL using UPDATE and SET commands. We will cover the syntax and examples, providing explanations to help you understand how to update multiple columns in SQL with a single query.

  5. How to UPDATE Multiple ROWs in a Single Query in MySQL?

    Jun 11, 2024 · To update multiple columns in MySQL we can use the SET clause in the UPDATE statement. SET clause allows users to update values of multiple columns at a time. In this article, we will learn how to update multiple columns in MySQL using UPDATE and SET commands.

  6. UPDATE multiple rows with different values in one query in MySQL

    Multiple Updates in MySQL. You can do it this way: SET cod_user = (case when user_role = 'student' then '622057' when user_role = 'assistant' then '2913659' when user_role = 'admin' then '6160230' end), date = '12082014' WHERE user_role in ('student', 'assistant', 'admin') AND. cod_office = '17389551'; I don't understand your date format.

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

    For the multiple-table syntax, UPDATE updates rows in each table named in table_references that satisfy the conditions. Each matching row is updated once, even if it matches the conditions multiple times. For multiple ... mysql> UPDATE items > SET retail = retail * 0.9 > WHERE id IN > (SELECT id FROM items > WHERE retail / wholesale >= 1.3 AND ...

  8. mysql - How can I UPDATE multiple ROWs in a Single Query with multiple

    Feb 18, 2018 · It is possible to update rows based on some condition. It is also possible to update multiple tables in one statement in MySQL. Whether the latter is a good idea is debatable, though.

  9. How to update multiple rows at once in MySQL? - TablePlus

    Nov 12, 2018 · There are a couple of ways to do it. 1. You can either write multiple UPDATE queries like this and run them all at once: 2. Or you can UPDATE with JOIN statement: SELECT 1 as id, 5 as new_score1, 8 as new_score2. UNION ALL. SELECT 2, 10, 8. UNION ALL. SELECT 3, 8, 3. UNION ALL. SELECT 4, 10, 7. 3. Or you can use INSERT ...

  10. Update Multiple Rows With Different Values With Single Query

    14 hours ago · Now, we understand the potential drawbacks of using multiple UPDATE statements in the scenario. Let’s improve on the SQL code from the previous section to update our user table in a single query. To do this, we can use a SQL CASE statement to allow us to provide multiple values for a range of conditions, all within a single query:

Refresh