[SQL] Related table question
Ruslan Zasukhin
sunshine at public.kherson.ua
Thu Jan 15 10:23:30 CST 2004
on 1/15/04 9:56 AM, Eric Forget at forgete at cafederic.com wrote:
> Hi,
>
> I have 2 tables:
>
> Table1 has some fields...
>
> Table "Keyword" has:
>
> VDK_ObjectPtr mTable1;
> VDK_String mName;
>
> If I query
>
> SELECT DISTINCT Table1.RecID FROM Table1, Keyword WHERE Keyword.Name = 'me'
>
> I will have all the records of Table1 that have a related Keyword.Name =
> 'me'.
>
> For the reverse I tried:
>
> SELECT DISTINCT Table1.RecID FROM Table1, Keyword WHERE Keyword.Name <> 'me'
>
> This will works only if the record of Table1 has at least 1 related Keyword
> relation. If it has not it is excluded. How can I include those?
You need to use LEFT OUTER JOIN
SELECT DISTINCT Table1.RecID
FROM Table1, Keyword
WHERE Table1.RecID *= Keyword.mTable1 AND
Keyword.Name <> 'me'
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina
mailing list