赞
踩
select
n.date,n.id,n.money
from
(
select
ROW_NUMBER() OVER(PARTITION BY m.date,m.id ORDER BY m.date1 desc) AS rn
m.date,m.id,m.money
from (
select
dim.date,table.date as date1,dim.id,table.money
from dim,table
where dim.date>=table.date and dim.id=table.id
) m
) n
where n.rn=1 and m.money>0
20200801 20200801 1 1000
20200802 20200801 1 1000
20200802 20200802 1 2000
20200803 20200801 1 1000
20200803 20200802 1 2000
20200804 20200801 1 1000
20200804 20200802 1 2000
20200805 20200801 1 1000
20200805 20200802 1 2000
20200805 20200805 1 5000
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。