我有一张桌子products
与prices
和colours
列。我需要一个视图来获得每种颜色的五大最昂贵的产品。我该怎么办?
这样做:
select * from (select a.*,rank() over (partition by colour order by price desc) rk from
tableaname a) where rk<6;
而是这个:
CREATE VIEW view_name AS select * from (select a.*,rank() over (partition
by colour order by price desc) rk from
tableaname a) where rk<6;