开发者

SQL ignore case in group by? (oracle)

开发者 https://www.devze.com 2023-01-25 08:29 出处:网络
Can you ignore case in a group by? For example if there is a table of开发者_StackOverflow社区 states but it has records with \"Alabama\" and \"alabama\", or \"Alaska\" and \"alaska\" and you want the

Can you ignore case in a group by? For example if there is a table of开发者_StackOverflow社区 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


Just use UPPER:

select upper(state), count(1)
  from your_table
 group by upper(state);
0

精彩评论

暂无评论...
验证码 换一张
取 消