SELECT FirstName, DateOfBirth, CURDATE(),
(YEAR(CURDATE())-YEAR(DateOfBirth))
- (RIGHT(CURDATE(),5)<RIGHT(DateOfBirth,5))
AS age
FROM basicinformation;
this is my query but what I want is after getting the age I must only view those that are above 18 years old. but if I add where age is greater than or equal to 18. I get query error. This might be because age is "as" (a tempory fieldname) and not really a field name. I hope someone could help me because i will use this for a automatic checking of age if they are already ready to vote or not.