日期:2014-05-18  浏览次数:20712 次

where 如何写
UPDATE [SRO_VT_ACCOUNT].[dbo].[SK_Silk] 
  set silk_own= silk_own+10 
  where SELECT UserJID,silk_own FROM [SRO_VT_SHARD].[dbo].[_OnOffline] a left join [SRO_VT_SHARD].[dbo].[_User] b on a.CharID = b.CharID where CStatus='ONline'


帮忙看看那怎么写WHERE SELECT的写法错误。应该怎么写
 

------解决方案--------------------
SQL code
UPDATE s 
  set s.silk_own= t.silk_own+10  --此处不确定你是要用哪一个的 silk_own,是s还是t,你自己改就好了
  from [SRO_VT_ACCOUNT].[dbo].[SK_Silk] s
  join (
       SELECT UserJID, silk_own 
       FROM [SRO_VT_SHARD].[dbo].[_OnOffline] a 
       left join [SRO_VT_SHARD].[dbo].[_User] b 
       on a.CharID = b.CharID where CStatus='ONline'
       ) t
    on s.JID = t.UserJID