取日期最大值语句
发布网友
发布时间:2022-04-30 04:19
我来回答
共2个回答
热心网友
时间:2023-10-12 04:18
select t.*
from (
select *,row_number() over(partition by 类别,商品名称 order by sdate desc) as rn
from table_name
where 类别 in ('超市','二批')
) t
where rn<=1
热心网友
时间:2023-10-12 04:18
select * from 表 a where exists(
select (
select 商品名称,MAX(SDate) as SDate
from 表 group by 商品名称) x where x.商品名称=a.商品名称 and a.SDate=x.SDate)
热心网友
时间:2023-10-12 04:18
select t.*
from (
select *,row_number() over(partition by 类别,商品名称 order by sdate desc) as rn
from table_name
where 类别 in ('超市','二批')
) t
where rn<=1
热心网友
时间:2023-10-12 04:18
select * from 表 a where exists(
select (
select 商品名称,MAX(SDate) as SDate
from 表 group by 商品名称) x where x.商品名称=a.商品名称 and a.SDate=x.SDate)