22,210
社区成员
发帖
与我相关
我的任务
分享
select t1.pid,t2.gid,t2.price,t1.other from
(select gid,min(price) price from t1 group by gid) t2
left join t1 on t1.gid=t2.gid and t1.price=t2.price
select * from (select *,@id:=if(`c_ID`=@gid,@id+1,1) as RN,@gid:=`gid` from table1 order by `gid`,`price`,`pid`) as t where RN=1 ;