[V4RB] Querying two related tables

Ruslan Zasukhin sunshine at public.kherson.ua
Tue Sep 28 18:38:36 CDT 2004


On 9/28/04 6:15 PM, "Eric Ferrer" <wonderfef at noos.fr> wrote:

Hi Eric,

> Hello all,
> 
> I need to display a list of Quotations along with the Names of the
> corresponding Clients.
> Here is the SQL statement I found:
> 
> SELECT QuoteNumber, Name FROM Quotes, Clients WHERE Quotes.ParentClientID =
> Clients.ID ORDER BY QuoteNumber DESC
> 
> It works fine, excepting that the returned cursor skips Quotations that do
> not have parent client (Quotes.ParentClientID = ''), which is bad for me
> because my application must allow the creation of Quotations without Client.

For this you should use LEFT OUTER JOIN


SELECT QuoteNumber, Name
FROM Quotes, Clients
WHERE Quotes.ParentClientID *= Clients.ID
ORDER BY QuoteNumber DESC


Note  *=


-- 
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