I have a query where I need to do a LIKE
in WHERE
indicating the current date.
It's this:
SELECT orden FROM tareas WHERE tipo = "Dos"
AND (fechaCierre IS NULL OR fechaCierre LIKE DATE_FORMAT(NOW(), '%Y-%m-%d'))
Of course, that of DATE_FORMAT(NOW(), '%Y-%m-%d')
returns "2018-10-19", but I want the WHERE to behave like LIKE '2018-10-19%'
, but I do not know how to put the% LIKE of the query.
I do not know if I explain. I want to put the% in the LIKE after the "operation" of DATE_FORMAT, but it does not work for me.
I've tried to put LIKE (DATE_FORMAT(NOW(), '%Y-%m-%d'))%
LIKE [DATE_FORMAT(NOW(), '%Y-%m-%d')]%
LIKE DATE_FORMAT(NOW(), '%Y-%m-%d') + %
and nothing, there's no way it works.
Greetings.