Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. 29 maj 2017 · Is it possible to do UPDATE query on MySQL which updates field value only if certain condition is met? Something like this: UPDATE test. SET. CASE. WHEN true. THEN field = 1. END. WHERE id = 123. In other words, "field" would be only updated if condition is met, otherwise nothing is done.

  2. I tried to find some solution and something like the following query seems to be the solution but I can't get it to work: UPDATE DeviceAttribute. SET Details = CASE Name. WHEN 'Accessories' IS NOT NULL THEN @Accessories. WHEN 'Description' IS NOT NULL THEN @Description.

  3. 14 sty 2022 · I have an update query in MySQL and I want to return true or false based on whether my update query was executed or not. Is there any way we can find whether the update query is executed? UPDATE table SET table.name = "Anthony" WHERE table.id = 3; IF (queryUpdated) THEN SELECT 1 AS updated; ELSE SELECT 0 AS updated; END IF;

  4. In this article, we would like to show you UPDATE query with IF condition in MySQL. Quick solution: UPDATE `table_name` SET `column_name` = IF(condition , if_true, if_false);

  5. 16 kwi 2016 · However, given how the conditions are re-used in your UPDATE statement, you could also take a different approach altogether: represent the affected IDs and the new values as a derived table and use an update with a join:

  6. 4 lis 2015 · You can't. ON DUPLICATE KEY UPDATE needs a unique or primary key to determine which row to update. You are better off having PHP do the IF ELSE part. edit: If the combination of name and id IS supposed to be unique, you can create a multi-column UNIQUE index. From there you can use ON DUPLICATE KEY UPDATE.

  7. www.mysqltutorial.org › mysql-stored-procedure › mysql-if-statementMySQL IF Statement - MySQL Tutorial

    Summary. Use IF...THEN statement to conditionally execute a block of statements based on the evaluation of a specified condition. Use IF...THEN...ELSE statement to execute a block of statements if a specified condition is true and an alternative block of statements if the condition is false.

  1. Ludzie szukają również