开发者

How do i do a case insensitive mysql contains string

开发者 https://www.devze.com 2023-03-24 21:09 出处:网络
I am do开发者_如何学编程ing a query that needs to search if the work software is in the string...the only problem is that it maybe upper or lower case so i was thinking of doing this

I am do开发者_如何学编程ing a query that needs to search if the work software is in the string...the only problem is that it maybe upper or lower case so i was thinking of doing this

and (cd.name LIKE '%software%' or cd.name LIKE '%Software%' )

but i feel like there is another way if anyone knows


MySQL is case insensitive.

These will give the same results, so you can use either: cd.name LIKE '%software%' cd.name LIKE '%Software%'

That's what the 'ci' is for in the different collations (latin1_general_ci, latin1_swedish_ci)


You can always try

LOWER(cd.name) LIKE '%software%'
0

精彩评论

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