> If your dateOfBirth is a date field, 

It is.

> you can do this:
> 
> select 
> (substring(curdate(),1,4)-substring(dateofbirth,1,4))-
> (substr(curdate(),5)<substr(dateofbirth,5)) 
> as age
>  from myTable;

Thanks.  That's a little more accurate (thought that doesn't quite 
matter in my case).

 
> But you can't get a group by from an alias.

That surprises me.  I tried putting the calculation of age in a 
subquery but that didn't work, either.  And I've never quite figured 
out how to create a temporary table for intermediate results.  There 
has _got_ to be a way to do this, even an awkward way.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to