Reputation: 325
I have a table called dependent:
And now I need to present the dependents more than 40 years old for example.
P.S. Right now I am trying to use DATEDIFF(CURDATE(), dependent.bdate)/365.25
function, but still can't present it. How to do this?
Upvotes: 0
Views: 46
Reputation: 164881
Assuming bdate
is an actual DATE
column, I think it would be easier to create a date 40 years prior to the current date and select where bdate
is less-than or equal to that date
WHERE dependent.bdate <= DATE_SUB(CURDATE(), INTERVAL 40 YEAR)
Upvotes: 1