oracle SQL 在 group by 中忽略大小写?(神谕)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4167823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 21:56:17 来源:igfitidea点击:
SQL ignore case in group by? (oracle)
提问by llcf
Can you ignore case in a group by? For example if there is a table of states but it has records with "Alabama" and "alabama", or "Alaska" and "alaska" and you want the group by that column but just get back a single 'group' for Alabama and Alaska.
您可以忽略组中的大小写吗?例如,如果有一个州表,但它有“阿拉巴马州”和“阿拉巴马州”或“阿拉斯加州”和“阿拉斯加州”的记录,并且您希望按该列分组,但只返回阿拉巴马州的一个“组”和阿拉斯加州。
thanks
谢谢
回答by Pablo Santa Cruz
Just use UPPER:
只需使用 UPPER:
select upper(state), count(1)
from your_table
group by upper(state);