Subject Re: [firebird-support] Re: Using COMPUTED fields to provide lookup results and allow backup/restore
Author Raymond Kennington
"Alexander V.Nevsky" wrote:
> --- In, Raymond Kennington
> <progsol@c...> wrote:
> > (I am amazed that the language allows for something that appears to
> be
> > very useful but is not functioning as described or is considered
> poor
> > design.)
> I don't know when and for what this feature was implemented, but I
> incline to treat it at least as incomplete.
> > Do you think I should use the client software (Delphi, in my case)
> to
> > do the lookup in order to display the looked-up value of a
> > lookup-field?
> If I right understand you, let's say you have table
> Table T1 (
> ID Int Not Null Primary Key,
> Name Varchar (80)
> )
> and
> Table T2 (
> ID Int Not Null Primary Key,
> T1_ID Int,
> Name Varchar (80),
> [attributes]
> Constraint T2_T1_FK Foreign Key (T1_ID) References T1)
> and you want present to user
> T2.Name, T1.Name, [attributes]
> Make it by
> Select T2.Name T1Name, T1.Name T2Name, ...
> >From T2 Inner Join T1 On T1.ID=T2.T1_ID
> Where [conditions]
> it will be much faster and reliable. If relationship allows not to
> have corresponded row in T1, use Left Join instead of Inner.
> Best regards, Alexander.

Thanks. I will have to do this for record maintenance (in a control
grid of suitable dimensions, i.e. #paddocks by #Location/Batches) as:

SELECT P."Paddock", FgP."Qty Fed", FI."Batch", FL."Location"
FROM "Feeding Paddock" FgP
JOIN "Paddock" P ON FgP."Paddock ID" = P.ID
JOIN "Feeding Inventory" FgI ON FgP.ID = FgI."Feeding
Inventory ID"
JOIN "Feed Inventory Location" FIL ON FgI."Inventory Location
JOIN "Feed Inventory" FI ON FIL."Inventory ID" =
JOIN "Feed Location" FL ON FIL."Location ID" =

and I thought it would be best to avoid having to specify this in
client code.

Would a VIEW for this SELECT allow me to add/edit/delete records from
the "Feeding Paddock" table?
Raymond Kennington
Programming Solutions
TeamW2W (InfoPower)