Subject Re: [firebird-support] error: invalid database key.
Author Helen Borrie
At 04:28 PM 15/12/2004 +0000, you wrote:


>I get the "invalid database key" error every time I try to open the
>view, whether using an IBTable component in C++Builder or the data
>tab in the properties box from IBConsole. However, I can use:
>SELECT *
>FROM "LeaseDue";
>
>and retrieve the results very easily. What's wrong with this picture?

The view definition is defective. Your aliasiing implies a join between
two tables, aliased as L and LL respectively, yet there is no join in the
SELECT statement.

Create View "LeaseDue" ("LeaseKey", "Due")
As
Select L."LeaseKey", Sum(LL."Amount") As "Due"
From "Lease Ledger"
Where ("Type" Not In ('Payment', 'Credit')) And ("PostDate" < Cast
('now' As Date))
Group by L."LeaseKey"
;
Assuming there is no join, and both fields are derived from "Lease Ledger",
correct this to:

Create View "LeaseDue" ("LeaseKey", "Due")
As
Select "LeaseKey", Sum("Amount") /* As "Due" NO */
From"Lease Ledger"
Where ("Type" Not In ('Payment', 'Credit')) And ("PostDate" < Cast
('now' As Date))
Group by "LeaseKey"
;

./heLen