SQL:更新表,其中列 = 多个值 [英] SQL: Update table where column = Multiple Values

查看:35
本文介绍了SQL:更新表,其中列 = 多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个更新表列的 SQL 查询,其中另一列 = 值

I created an SQL query which updates a table column where another column = value

代码:

Update Products Set ProductName = 'Shoes' WHERE ProductID = (1,2,3,4,5,6,7,8)

问题在于 ProductID.我怎样才能让它用这些 ID 更新列?

The problem is with the ProductID. How can I make it update the column with those ID's ?

问候.

推荐答案

Replace ProductID =ProductID IN

Replace ProductID = with ProductID IN

Update Products 
Set ProductName = 'Shoes' 
WHERE ProductID IN (1,2,3,4,5,6,7,8) 

这篇关于SQL:更新表,其中列 = 多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆