About 46,500 results
Open links in new tab
  1. sql - MySQL syntax for Join Update - Stack Overflow

    MySQL supports a multi-table UPDATE syntax, which would look approximately like this: UPDATE Reservations r JOIN Train t ON (r.Train = t.TrainID) SET t.Capacity = t.Capacity + r.NoSeats WHERE r.ReservationID = ?; You can update the Train table and delete from the Reservations table in the same transaction. As long as you do the update first and ...

  2. join - MySQL update a joined table - Stack Overflow

    Oct 18, 2019 · UPDATE tableA a JOIN tableB b ON a.a_id = b.a_id JOIN tableC c ON b.b_id = c.b_id SET b.val = a.val+c.val WHERE a.val > 10 AND c.val > 10; There is no FROM clause in MySQL's syntax. UPDATE with JOIN is not standard SQL, and both MySQL and Microsoft SQL Server have implemented their own ideas as an extension to standard syntax.

  3. MySQL - UPDATE query based on SELECT Query - Stack Overflow

    I found that that was too complex to incorporate into a SELECT within mysql, so I created a temporary table, and joined that with the update statement:- CREATE TEMPORARY TABLE activity_product_ids AS (<the above select statement>); UPDATE activities a JOIN activity_product_ids b ON a.activity_id=b.activity_id SET a.product_id=b.product_id;

  4. mysql - How to update column with null value - Stack Overflow

    Feb 7, 2011 · If you want to set null value using update query set column value to NULL (without quotes) update tablename set columnname = NULL . However, if you are directly editing field value inside mysql workbench then use (Esc + del) keystroke to …

  5. MySQL Update Inner Join tables query - Stack Overflow

    mysql> create table business (business_id int unsigned primary key auto_increment, mapx varchar(255), mapy varchar(255)) engine=innodb; Query OK, 0 rows affected (0.01 sec) mysql> create table business_geocode (business_geocode_id int unsigned primary key auto_increment, business_id int unsigned not null, latitude varchar(255) not null ...

  6. mysql update column with value from another table

    Jul 29, 2012 · mysql> update link_productgroepen set groep_id=(select groep_id from link_productgroepen_bck where link_productgroepen.sku=link_productgroepen_bck.sku); link_productgroepen_bck contains a backup of the table link_productgroepen ,so the structure is …

  7. mysql - ERROR 1064 (42000): You have an error in your SQL …

    Mar 20, 2016 · While using mysql version 8.0 + , use the following syntax to update root password after starting mysql daemon with --skip-grant-tables option. UPDATE user SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_new_password')

  8. MySql How to set a local variable in an update statement (Syntax?)

    Dec 12, 2011 · Seems mySQL will use the new assigned value instead of original value in the table. This is different from MS SQL. To make it more clear, try the following example, the value will be 1001 for col3 and @tempVariable.

  9. MySQL update CASE WHEN/THEN/ELSE - Stack Overflow

    Oct 6, 2012 · UPDATE `table` SET uid = ELT(id, 2952, 4925, 1592) WHERE id IN (1,2,3) As ELT() returns the Nth element of the list of strings: str1 if N = 1, str2 if N = 2, and so on. Returns NULL if N is less than 1 or greater than the number of arguments.

  10. sql - Multiple Updates in MySQL - Stack Overflow

    The next one will update all rows where the value of Column2 is more than 5. Update Table Set Column1 = 'New Value' Where Column2 > 5 There is all Unkwntech's example of updating more than one table. UPDATE table1, table2 SET table1.col1 = 'value', table2.col1 = 'value' WHERE table1.col3 = '567' AND table2.col6='567'

Refresh