欢迎访问服务器技术网-www.fuwuqijishu.com

sql 分组排序

程序设计 fuwuqijishu 2年前 (2022-10-01) 10次浏览 0个评论 扫描二维码

关于附件里面有两张表,我要通过分组查出第三个结果的问题

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。

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Warning: error_log(/www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/#log/log-2516.txt): failed to open stream: No such file or directory in /www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/spider.class.php on line 2900