删除不同粒度的事实表记录中重复的度量值数据的SQL语句
update vtronstaging.dbo.fact_t_purchasing
set 通知數(shù)量 = 0, 通知單號(hào) =0? where 通知單ID is null
update vtronstaging.dbo.fact_t_purchasing
set 實(shí)際入庫(kù)數(shù)量 = 0, 實(shí)際入庫(kù)單價(jià) = 0, 實(shí)際入庫(kù)金額 = 0, 入庫(kù)單號(hào) = 0, 入庫(kù)日期 = '01/01/2049' where 入庫(kù)單ID is null
update vtronstaging.dbo.fact_t_purchasing
set 訂貨數(shù)量 = 0 , 采購(gòu)金額 = 0
from vtronstaging.dbo.fact_t_purchasing t1
where [入庫(kù)單號(hào)] <>
? (
?select top 1 [入庫(kù)單號(hào)]
?from vtronstaging.dbo.fact_t_purchasing t2
?where t1.采購(gòu)單ID = t2.采購(gòu)單ID and t1.采購(gòu)單分錄ID = t2.采購(gòu)單分錄ID
?order by [入庫(kù)單號(hào)] desc
? )
轉(zhuǎn)載于:https://www.cnblogs.com/Jasper-Wang/archive/2006/07/24/458227.html
總結(jié)
以上是生活随笔為你收集整理的删除不同粒度的事实表记录中重复的度量值数据的SQL语句的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 别了,博格坎普
- 下一篇: SQL语句对象化,先看示例代码.