Hi I don't use MySQl but you should use the newer SQL syntax, something like the following...

SELECT  cl.*,

               sub.Type,

               c.City,

s.StreetName
FROM  TSubs  sub
JOIN TClient cl ON cl.ID = sub.ID

LEFT JOIN TCity c ON c.ID = cl.CityName

LEFT JOIN TStreet s ON c.ID = cl.StreetName

WHERE sub.SubType IN(1,2,4,5)

     AND cl.Active = true





Rob Martin
Software Engineer

phone +64 03 377 0495
fax   +64 03 377 0496
web www.chreos.com

Wild Software Ltd



[EMAIL PROTECTED] wrote:

Hi all

How can I translate the following sql into one using LEFT OUTER JOIN on the tables TCity and TStreet? This to get all records of TClient including the once that do not have a relation with TCity or TStreet.

SELECT  cl.*,

                sub.Type,

                c.City,

s.StreetName
FROM   TClient cl,

                TSubs sub,

                TCity c,

                TStreet s

WHERE cl.ID = sub.ID

      AND cl. StreetName = s.ID

      AND cl. CityName      = c.ID

      AND sub.SubType IN(1,2,4,5)

      AND cl.Active = true

Thanks for your help

John

------------------------------------------------------------------------

_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe
_______________________________________________
NZ Borland Developers Group Offtopic mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/offtopic
Unsubscribe: send an email to [EMAIL PROTECTED] with Subject: unsubscribe

Reply via email to