关于附件里面有两张表,我要通过分组查出第三个结果的问题
with ranked as
(select t1。*, rank() over (partition by name order by price desc) as rk from table1 t1 join table2 t2 on t1。
goods=t2。goods)
select , b。goods as goods1, c。goods as goods2, d。
goods as goods3 from (select name from table1 group by name) a join (select name, goods from ranked where rk =1) b on = join (select name, goods from ranked where rk =2) c on = join (select name, goods from ranked where rk =3) d on = order by name。