[thelist] [OT] - mysql dbt.

rudy r937 at interlog.com
Thu Nov 22 14:02:31 CST 2001

> I cannot understand why we require
>  " -  (RIGHT(CURRENT_DATE,5)<RIGHT(birth,5))"
> and what it does.

hi navin

the "<" is a comparison

it will evaluate as either 1 or 0 (true or false)

1 if today's month/day is less than the birthday month/day, otherwise 0

so first you subtract years to get a number for the age, but then you
have to subtract 1 if the birthday hasn't arrived yet *in this year*

the answer was pretty much right there in the excerpt you gave from the
manual --

> To determine how many years old each of your pets is, compute the
> difference in the year part of the current date and the birth date, then
> subtract one if the current date occurs earlier in the calendar year than
> the birth date.


More information about the thelist mailing list