Search results
23 cze 2013 · I am trying to UPDATE values from a table, but I need to add some conditions. I found the function CASE , but I am not if it is the best method. Here is an example.
16 kwi 2016 · In MySQL, you can use tuple comparison: WHERE (TestId, TestSubId) IN ((10,25), (11,22)) That looks nice and succinct, although, as ypercubeᵀᴹ mentioned in a comment, it may not work well performance-wise.
18 lut 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.
How we can change two variables in one condition. For example, consider that when @var1<50 , we want to change not only @var1 := @var1+col5 , but also re-assign @var2 := @var2 + 100 . In fact, regardless of the condition 2, we want to increase @var2 , if the first condition fails (the second part).
16 lut 2024 · In this article, we’ll learn the use of the CASE statement, IF() function, INSERT ... ON DUPLICATE KEY UPDATE clause and UPDATE with JOIN() function to update multiple columns in multiple rows with different values in MySQL.
26 cze 2024 · Updating table rows using subqueries in MySQL enables precise modifications based on specific conditions or values from other tables. This technique leverages subqueries within the SET or WHERE clauses of the UPDATE statement, allowing dynamic and context-specific updates.
The MySQL UPDATE Statement. The UPDATE statement is used to modify the existing records in a table. UPDATE Syntax. UPDATE table_name. SET column1 = value1, column2 = value2, ... WHERE condition; Note: Be careful when updating records in a table! Notice the . WHERE clause in the UPDATE statement.