views:

64

answers:

1

How do I calculate number of years since product was made (rounded to 1 decimal point) for products that were made less than five years ago? Thank you.

+4  A: 

Not in front of an IDE right now so my syntax may be a little off but something like this should work (assuming a table named table1 with a field named date1) ...

select round((Months_between(current_date,date1)/12),1) as years 
from table1 where date1 > add_months(current_date,-60)
kekekela
+1: Looks correct to me
OMG Ponies