SQL语句修改,如何将下面的insert语句改为update语句。
发布网友
发布时间:2024-10-13 13:37
我来回答
共2个回答
热心网友
时间:2024-12-04 07:42
-- for M$SQL
update a set
error = b.error
, normal = b.normal
, unknown = b.unknown
, exectime = getdate()
from r_count as a
join (
select type,
sum(case when flag=0 then 1 else 0 end) as "error",
sum(case when flag=1 then 1 else 0 end) as "normal",
sum(case when flag=2 then 1 else 0 end) as "unknown",
from R_NewsUser_Netbar
group by type
) as b on 1=1
and 'News' = a.type
and b.type = a.xtype
热心网友
时间:2024-12-04 07:43
你要更新什么啊?追问更新除了type和xtype的后4列