>
> our DB have a field with dob from our clients. I'm looking
> for a script to calculate the age including WHERE clauses.
>
> But MySQL give an error: Unknown column "Age" in where clause.
>
> Please look:
>
> SELECT
> Name,
> dob,
> year(current_date) - year(dob) -
> (if(dayofyear(dob)>dayofyear(current_date),1,0)) AS Age FROM
> cand WHERE 1=1 AND Age > 1
Aliased columns aren't usable until the query is returned
So you have to use the same calculation in the WHERE
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

