select * from( SELECT row_number() over(PARTITION BY productid ORDER BY sort,Price) as number,* from productattr where flag=false )x WHERE NUMBER=1
SQL取分组数据的所有第一条数据
原文:https://www.cnblogs.com/zengtianli/p/10608200.html