skip characters in like clause of mysql
hello I want to skip some character while matching any string using like
using mysql
. For example I have a string like this 2011-07-12 06:09
. I want to match the only month part of the time stamp not whole. I kn开发者_Go百科ow I can use %
for whole string. I want to skip characters from front and end of that part. Would any body tell me how to accomplish this job
Use the MONTH()
function for grabbing the month from a date. Don't re-invent the wheel.
If you're really interested in matching a string using like
, you'd be better off using the underscore (_
) as a the wildcard:
select *
from some_table
where some_column like '__-07-__ __:__'
精彩评论