生成开发环境中,发现通过not like 's_%' 出来的结果是不正确的。会过滤掉例如"spcn_xxxx"等的数据。如下
and tt.TABLE_NAME not like 's_%'
and TABLE_NAME = 'spcn_undeal'
会查不到spcn_undeal这个表的数据。
解决方案:
通过position来实现startWith的功能。如下:
and position('s_' IN tt.TABLE_NAME) != 1)
本文介绍了在开发环境中遇到的notlike模糊查询导致数据过滤不准确的问题,并提供了一种使用position函数来替代notlike实现startsWith功能的方法。

1万+

被折叠的 条评论
为什么被折叠?



