22,209
社区成员
发帖
与我相关
我的任务
分享
select *
from
(
select d.*
row_number() over(partition by memcardno,wareid order by accdate desc) rn
from r_sale_memcard d
where wareid<>'TOTAL' and saleqty<>'0' and wareid<>'TOTAL' and saleqty<>'0'
)v
where v.rn = 1
[/quote]
谢谢大神 完美解决我的问题了select *
from
(
select d.*
row_number() over(partition by memcardno,wareid order by accdate desc) rn
from r_sale_memcard d
where wareid<>'TOTAL' and saleqty<>'0' and wareid<>'TOTAL' and saleqty<>'0'
)v
where v.rn = 1
select *
from
(
select d.*
row_number() over(partition by memcardno,wareid order by accdate desc) rn
from r_sale_memcard
where wareid<>'TOTAL' and saleqty<>'0' and wareid<>'TOTAL' and saleqty<>'0'
)v
where v.rn = 1