级连查询与更新

2年前 (2022) 程序员胖胖胖虎阿
130 0 0

select DATEADD(day,v.LearningDay,sc.OrderTime) AS OrderPayDate, sc.LearninTime,v.VideoTitle,sc.OrderTime,v.LearningDay from
ShoppingCart sc
left join video v
on sc.MatterId=v.Id
where sc.OrderTime is not null

update sc
set sc.LearninTime = r.OrderPayDate
from ShoppingCart sc,
(select sc.Id, DATEADD(day,v.LearningDay,sc.OrderTime) AS OrderPayDate, sc.LearninTime,v.VideoTitle,sc.OrderTime,v.LearningDay from
ShoppingCart sc
left join video v
on sc.MatterId=v.Id
where sc.OrderTime is not null
) as r
where sc.Id=r.Id

版权声明:程序员胖胖胖虎阿 发表于 2022年10月28日 上午9:24。
转载请注明:级连查询与更新 | 胖虎的工具箱-编程导航

相关文章

暂无评论

暂无评论...