sql实现分组中并进行序号排序
发布日期:2021-06-29 13:13:51 浏览次数:2 分类:技术文章

本文共 474 字,大约阅读时间需要 1 分钟。

sql:row_number() over(partition by xxxxxxxxxx order by yyyyyyyyyyyyy)

xxxxxxxxxx:分组字段;yyyyyyyyyyyyy:排序字段

select  

row_number() over(partition by d.area_code order by a.customer_name),  
a.customer_name, d.area_code 

from jc_customer as a

left join jc_province as b on a.province = b.province_name
left join jc_city as c on a.city = c.city_name and b.province_code = c.province_code
left join jc_area as d on a.area = d.area_name and c.city_code = d.city_code
order by d.area_code 
 

 

转载地址:https://changemax.blog.csdn.net/article/details/100019751 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Inspection info:Detects duplicates in source code 如何解决
下一篇:RelativeLayout中layout_alignParentRight="true"无效的解决办法

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2024年04月22日 23时24分28秒