سؤال

I have a row which contains 'asa' string in my MySQL database. Then I am trying to get result from query when input is like that 'asas2s'
But I couldn't get result.

My query is like that:

SELECT * FROM mod WHERE course LIKE '%asa2s%'
هل كانت مفيدة؟

المحلول

You can use this, but it is slow query because the predicate is not SARGable.

SELECT * FROM mod WHERE 'asas2s' LIKE concat(course, '%')
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top