Subject | Re: Using COMPUTED fields to provide lookup results and allow backup/restore |
---|---|
Author | Alexander V.Nevsky |
Post date | 2003-07-15T19:17:59Z |
--- In firebird-support@yahoogroups.com, Raymond Kennington
<progsol@c...> wrote:
incline to treat it at least as incomplete.
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.
<progsol@c...> wrote:
> (I am amazed that the language allows for something that appears tobe
> very useful but is not functioning as described or is consideredpoor
> 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 aIf I right understand you, let's say you have table
> lookup-field?
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.