[V4RB+Vserver] multiple JOIN

Eric Ferrer wonderfef at noos.fr
Wed Nov 10 12:21:04 CST 2004


Hello,

I have a table "Lists" with fields :
Name, ParentUserID, ParentCompanyID

and 2 other tables "People" and "Companies", both with fields "ID" and
"Name".

ParentUserID may contain either the ID of a person (in table People) either
the ID of a company (in table Companies).

I need Valentina to "join" those 3 tables:

SELECT Lists.Name, Companies.Name, People.Name
FROM Lists, Companies, People
WHERE
(Lists.ParentUserID *= People.ID
OR
Lists.ParentUserID *= Companies.ID)
AND
Lists.ParentCompanyID *= Companies.ID

But, of course, this does not work because the field Companies.Name cannot
contain 2 values taken from 2 different links.

I can't figure out a workaround...
Thanks in advance for your help.
Eric




More information about the Valentina mailing list