Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql update multiple rows

UPDATE table_name SET column1=value1, column2=value2 WHERE condition
Comment

update multiple columns in sql

UPDATE table-name SET column-name = value, column-name = value WHERE condition = value
Comment

update table sql multiple set

-- CANT do multiple sets but can do case
UPDATE table
SET ID = CASE WHEN ID = 2555 THEN 111111259 
              WHEN ID = 2724 THEN 111111261
              WHEN ID = 2021 THEN 111111263
              WHEN ID = 2017 THEN 111111264
         END
WHERE ID IN (2555,2724,2021,2017)
Comment

sql update multiple tables

/*You can't update multiple tables in one statement,
however, you can use a transaction to make sure that
two UPDATE statements are treated atomically.
You can also batch them to avoid a round trip.*/


BEGIN TRANSACTION;

UPDATE Table1
  SET Table1.LastName = 'DR. XXXXXX' 
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = '011008';

UPDATE Table2
SET Table2.WAprrs = 'start,stop'
FROM Table1 T1, Table2 T2
WHERE T1.id = T2.id
and T1.id = '011008';

COMMIT;
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql datetime format 
Sql :: sql alter column name sql server 
Sql :: sql join 
Sql :: mysql dump for selected row 
Sql :: sql rename column in select query 
Sql :: sql if null then string 
Sql :: sql remove check constraint 
Sql :: client does not support authentication protocol requested by server sqlyog 
Sql :: show tablespace oracle 
Sql :: SQL add a totals of differemt rows of the same id 
Sql :: sql primary key constraint 
Sql :: sql to linq 
Sql :: change column name sql 
Sql :: commit transaction sql 
Sql :: 1422: Explicit or implicit commit is not allowed in stored function or trigger 
Sql :: mariadb create view 
Sql :: close external port 3306 with iptables 
Sql :: change password in mysql 
Sql :: sql query to return field name of a table 
Sql :: count weekend days between two dates sql 
Sql :: group_concat mysql 
Sql :: select only unique values from and to current table 
Sql :: pl sql create function 
Sql :: changing column names in sql query results 
Sql :: SQL AVG() Function 
Sql :: sql select rows with simlar names 
Sql :: python sqlalchemy orm to select null values 
Sql :: sql order 
Sql :: compression of dabatase mysqldumo 
Sql :: Write the order of execution of all the SQL clauses and statements 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =