10
I have the following condition:
WHERE sv_users.userDataNascimento LIKE '%95%';
And this condition searches a date (11/12/1995
), of the kind VARCHAR
and not Timestamp
, one year ending with the numerals 95
. This numeral is the result of a calculation I do in my code to find the year of birth of the user searched in the filter in a form.
I arrive in the year through this calculation:
idadeDigited - Anocurrent = Anodenation
So I set up the consultation. So far so good.
But, if I want to search in this field a date that is smaller than, or larger than the numeral obtained in the calculation, for example, dates (VARCHAR
) ending with the last two smaller numerals than the one resulting from the calculation (which in this case is 95
), how do I? What I use?
It is possible to convert this field to
date
? withvarchar
you will have trouble sorting dates. To compare the year of a datedate
useyear()
. ex:select year(now())
– rray