I have this sql statment:
SELECT * FROM users WHERE (DATE_FORMAT(dob, '%Y') - $strYear)<=3
Which works, kinda, but if the year of the DOB is more (later) than $strYear it goes wrong.
ie.
strYear = 1960
dob(Y) = 1930
1930 - 1960 = -30 which fulfills the <=3 condition, but is obviously wrong as I’m looking for users within in 3 year range.
Any ideas?
How about
That might work.