在MySQL数据库中
我有一个表SELECT DISTINCT
[id] = IDENTITY(INT, 1,1)
,category
,[percentage] = ROUND(100 * SUM(CASE complete WHEN 'yes' THEN 1.0 ELSE 0.0 END)
OVER (PARTITION BY CATEGORY)/
COUNT(*) OVER (PARTITION BY Category),0)
INTO #table2
FROM #tab
ORDER BY [percentage] DESC;
SELECT *
FROM #table2;
,其中包含一些示例行,如下所示:
License
有很多这样的行,我想修改如下:
ID | Key | Location
1 25 C:/Public/lics/1885-0001.lic
3 21 C:/Public/lics/1885-0006.lic
所有行中的一列都会被修改。如何更新表以在所有行中进行此更改。
答案 0 :(得分:1)
从我在评论中发布的文档来看,我认为你应该这样做:
UPDATE License SET Location = REPLACE(Location, 'C:/Public/lics', 'C:/Licenses');
答案 1 :(得分:0)
UPDATE License
SET Value = REPLACE(Location, 'Public/lics', 'Licenses')