尝试将它们规范化(转换为大写并删除 '"' ),所以会是一样的 JIIT 之后 group by :
select case when college = 'BSA' then 'BSA College of Technology'
--add other cases
else --rule for others
trim(upper(regexp_replace(college,'"','')))
end as college
,COUNT(*) as cnt
from students
group by
case when college = 'BSA' then 'BSA College of Technology'
--add other cases
else --rule for others
trim(upper(regexp_replace(college,'"','')))
end --the same sentence should be in group by, or use subquery instead
;
应用 case 转换更复杂的字符串,如 MJP ROHILKHAND 以及 M J P ROHILKHAND 都一样。 这是因为数据库没有规范化,输入也没有限制 College 按大学维度列出。
1条答案
按热度按时间yuvru6vn1#
好像你在同一所大学有很多不同的名字,像这样
尝试将它们规范化(转换为大写并删除
'"'
),所以会是一样的JIIT
之后group by
:应用
case
转换更复杂的字符串,如MJP ROHILKHAND
以及M J P ROHILKHAND
都一样。这是因为数据库没有规范化,输入也没有限制
College
按大学维度列出。