Re: field values via formulas
Andriy Pasichnyk wrote:
> if i have mysql table fields called 'YearOfBirth' and 'Age'. how can i make 'Age' be counted
> automaticly by subtracting 'YearOfBirth' from 'CurrentYear'?
SELECT YEAR(CURDATE()) - YearOfBirth AS Age FROM people ...
But it would be better to store the DayOfBirth instead of the YearofBirth (people born in e.g. December may not like being one year older than they really are most of the year ;-)
--
felix
Please use
BBCode to format your messages in this forum.
Subject
Written By
Posted
Re: field values via formulas
May 31, 2005 01:20AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.