case when和grouping sets执行顺序
时间: 2023-08-21 20:15:06 浏览: 197
引用\[3\]中提到,可以通过在SELECT语句中使用CASE WHEN来判断grouping sets的行。具体来说,可以使用grouping_id函数生成的二进制数来判断不同的grouping sets。例如,可以使用CASE WHEN语句来判断grouping_id的二进制数,从而确定不同的汇总级别。\[3\]所提到的示例中,使用了rpad、reverse和bin函数来处理grouping_id的二进制数,并根据不同的情况给出相应的标签。因此,CASE WHEN语句的执行顺序是在grouping sets之后进行的。
#### 引用[.reference_title]
- *1* [grouping sets函数](https://blog.csdn.net/weixin_47621995/article/details/108112707)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [SQL:grouping sets详解](https://blog.csdn.net/weixin_47198715/article/details/130727884)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [grouping sets的使用](https://blog.csdn.net/weixin_49118237/article/details/111881202)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文