Skip characters in a similar mysql section

hello I want to skip any character when matching any string using like with mysql . For example, I have a line like 2011-07-12 06:09 . I want the only monthly part of the timestamp to be not whole. I know that I can use % for a whole line. I want to skip the characters from the front and the end of this part. Can someone tell me how to do this job?

+4
source share
1 answer

Use the MONTH() function to capture the month from the date. Do not reinvent the wheel.

If you are really interested in matching a string with like , you'd better use the underscore ( _ ) character as a wildcard:

 select * from some_table where some_column like '__-07-__ __:__' 
+3
source

All Articles