sql update multiple rows with different values

I don't know SQL-Server, so I'm extrapolating from MySQL and hoping I get the syntax right. You can do it either...

sql update multiple rows with different values

I don't know SQL-Server, so I'm extrapolating from MySQL and hoping I get the syntax right. You can do it either with a JOIN: UPDATE t1 SET t1.TotalCost = t2. ,2016年4月14日 — UPDATE address SET start_date = create_date WHERE status = 'inactive' AND start_date = '1900-01-01'.

相關軟體 MySQL 資訊

MySQL
MySQL 是一個開源的 RDBMS(關係數據庫管理系統),它支持用 C,C ++,Java,Perl 和 PHP 等各種編程語言編寫的請求。由於其高速度和靈活性,MySQL 已成為主要用於開發各種形狀和大小的 Web 應用程序的最流行的數據庫系統之一。自 1995 年上市以來,這種非常受歡迎的開源數據庫管理系統已經應用於當今幾乎所有互聯網用戶的無數項目中。今天一些最受歡迎的 MySQL 用戶是 ... MySQL 軟體介紹

sql update multiple rows with different values 相關參考資料
MySQL - UPDATE multiple rows with different values in one ...

2016年1月19日 — You can do it this way: UPDATE table_users SET cod_user = (case when user_role = 'student' then '622057' when user_role = 'assistant' then ...

https://stackoverflow.com

SQL: Update Multiple Rows With Different values - Stack ...

I don't know SQL-Server, so I'm extrapolating from MySQL and hoping I get the syntax right. You can do it either with a JOIN: UPDATE t1 SET t1.TotalCost = t2.

https://stackoverflow.com

Update multiple rows with different values - THEN statement ...

2016年4月14日 — UPDATE address SET start_date = create_date WHERE status = 'inactive' AND start_date = '1900-01-01'.

https://stackoverflow.com

Update multiple rows with different values in a single SQL ...

2017年6月14日 — You can join on the same table using the NameID (+ the other columns) and specifying in the join clause to only join on a dataset which already ...

https://stackoverflow.com

Update multiple rows with different values in a single SQL query

2012年7月19日 — You could do: UPDATE table SET posX=CASE WHEN id=id[1] THEN posX[1] WHEN id=id[2] THEN posX[2] ... ELSE posX END, posY = CASE ... END WHERE id IN (id[1], id[2], id[3]...);

https://stackoverflow.com

Update multiple rows with different values in SQL - Stack ...

2010年12月8日 — UPDATE T SET Size = CASE SKU WHEN 'A' THEN 20 WHEN 'B' THEN 10 WHEN 'C' THEN 30 WHEN ... END. Or there may be a formula for ...

https://stackoverflow.com

Updating multiple rows with different values - Stack Overflow

2010年10月7日 — It has the fields 'id' and 'value'. Now, I want to update lots of rows in this table with a single SQL query, but many rows should get a different value.

https://stackoverflow.com

Updating multiple rows with different values in one query ...

UPDATE mytable SET fruit = CASE WHEN id=1 THEN 'orange' ELSE 'strawberry' END, drink = CASE WHEN id=1 THEN 'water' ELSE 'wine' END, food = CASE ...

https://dba.stackexchange.com