sql使用实例

  1. 将另一表中的合计值保存到指定字段,并将空值赋0   

update ShopInfo set JLRunningWater =(select COALESCE(sum(v.TotalMoney),0) as s from ViycooPayReturn v where v.ShopId=ShopInfo.ShopID and IsWithdraw=0)

原文地址:https://www.cnblogs.com/Celebrator/p/6848899.html