开发者

SQL ignore case in group by? (oracle)

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜