Sql case when 怎么使用 like ?
想要实现查询:如果字符串包含‘语文’就怎么怎么样,包含‘数学’就怎么怎么样,包含‘英语’就怎么怎么样。使用 like 放在case when 里面是无效的,可以用 instr() 这个函数来查找这些字符出现的位置,代替like的功能。case when instr(t.str,’语文’) > 0 then 0when instr(t.str,’数学’) > 0 then 1when instr(t.str,’英语’) > 0 then 2else 3 end...
原创
2020-06-11 09:06:56 ·
7083 阅读 ·
0 评论