Subject | Re: [ib-support] calculated fields in master-detail |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2002-11-08T14:33:11Z |
At 14:47 08.11.2002 +0100, you wrote:
it certainly is possible to use subqueries like
SELECT Master.Something, (select sum(SomeColumn) From Detail where
Detail.Somefield = Master.Somefield) as CalculatedField
FROM Master
WHERE...
but we all do this in our applications - not in the table definition
itself. I doubt it is possible to have calculated columns computed by
fields from another table (you can have calculated fields based on
constants and other values of the current record) - the closest you could
get would be adding a field to your master table and write triggers for
your detail table that updated the master. But I doubt this could be
considered good design.
So - rather than implementing something like this, I suggest you rethink
your design.
Set
>if I have two tables in master-detail relation, is it possible to haveHi Ulrich,
>calculated fields in master-table with values from the detail-table, or must
>I define a seperate view (with a join) for this purpose?
it certainly is possible to use subqueries like
SELECT Master.Something, (select sum(SomeColumn) From Detail where
Detail.Somefield = Master.Somefield) as CalculatedField
FROM Master
WHERE...
but we all do this in our applications - not in the table definition
itself. I doubt it is possible to have calculated columns computed by
fields from another table (you can have calculated fields based on
constants and other values of the current record) - the closest you could
get would be adding a field to your master table and write triggers for
your detail table that updated the master. But I doubt this could be
considered good design.
So - rather than implementing something like this, I suggest you rethink
your design.
Set