SQL取分组数据的所有第一条数据

select * from(
SELECT row_number() over(PARTITION BY productid ORDER BY sort,Price) as number,*
from productattr where flag=false
)x WHERE NUMBER=1

猜你喜欢

转载自www.cnblogs.com/zengtianli/p/10608200.html