Subject Re: [firebird-support] computed column with max(value) of referening rows out of a child table
Author Martijn Tonies
Hi,


> I want to
> ALTER TABLE <PARENTS>
> ADD <OLDESTCHILD> COMPUTED BY
> (SELECT MAX (<BIRTHDATE>) FROM <CHILDREN> WHERE <PARENTS_ID> =
PARENTS.ID;
>
> but I get a
> Dynamic SQL Error
> -SQL error code = -104
> -Token unknown - line 3, char 3
> -select
>
> what did I wrong?

Use an extra set of parenthesis:

( (SELECT MAX (<BIRTHDATE>) FROM <CHILDREN> WHERE <PARENTS_ID> =
PARENTS.ID ))

With regards,

Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird, MySQL & MS SQL
Server.
Upscene Productions
http://www.upscene.com