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. 17 maj 2024 · Updating a column with a NULL value in MySQL is surprisingly straightforward. Check out this basic syntax: UPDATE table_name. SET column_name= 'N/A' WHERE condition; table_name: The name of your table. column_name: The column you want to turn into NULL. condition: When you want to be selective. If you skip this, it'll update all rows.

  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); Practical example. To show UPDATE query with IF condition, we will use the following users table:

  5. 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.

  6. 30 wrz 2014 · if (table2 is empty) insert into table2 (table2.starttime, table2.endtime) value (table1.starttime, table1.endtime (last row)) else if (TIMESTAMPDIFF(SECOND,table2.endtime(last row),table1.starttime(lastrow))<10) update table2.endtime (last row) value (table1.endtime) else.

  7. 23 cze 2013 · I know I'm a little late to this, but I think an easier to read solution would be to use the IF() function in MySQL: UPDATE relation SET name1 = IF(userid1 = 3, 'jack', name1), name2 = IF(userid2 = 3, 'jack', name2) WHERE (userid1 = 3 AND userid2 = 4) OR (userid1 = 4 AND userid2 = 3);

  1. Ludzie szukają również