I have a table which has 3 columns. Name,DateOfBirth, DateDeceded. The fields DateOfBirth and DateDeceded have the data type DATE.
Now when i do a Select * from TableName. I want to display the Name, date of birth, date deceded and the number of years the person lived (DateDeceded – DateOfBirth).
How do i write the SQL Select statement to include the NumberOfYearsLived field ?
Try:
Edit: you might want to try this instead. It might be more accurate.
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampdiff