Article View: borland.public.interbase.sql
Article #11218Re: left join in TIBDataSet
From: Harun Bolat
Date: Wed, 11 Dec 2002 19:18
Date: Wed, 11 Dec 2002 19:18
27 lines
1907 bytes
1907 bytes
> SELECT ID, ID_TCosto, Descripcion, Valor, Accion
> FROM COSTO C
> LEFT JOIN TCOSTO TC
> ON C.ID_TCOSTO = TC.ID_TCOSTO
> WHERE C.ID = :ID
> 1) I didn't specify in which table is each field. Should I?
yes but all field that you select have to belong only one table. for example
if ID_TCOSTA field found COSTA and TCOSTO tables , select statement raise
error.
> 2) what's the difference with:
> SELECT C.ID, C.ID_TCosto, TC.Descripcion, C.Valor, TC.Accion
> FROM COSTO C, TCOSTO TC
> WHERE C.ID = :ID and C.ID_TCOSTO = TC.ID_TCOSTO
SELECT ID, ID_TCosto, Descripcion, Valor, Accion
FROM COSTO C
JOIN TCOSTO TC ON C.ID_TCOSTO = TC.ID_TCOSTO
WHERE C.ID = :ID
if drop left, results are same but first sql (join SQL) execution time less
than second.
but with left clause first sql result set maybe different.
Technical Details
Message-ID:
<3df78f42$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3df789da@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,809958e3ec144d77 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-11 11:35:10 PST Reply-To: "Harun Bolat" <harunbolat@kaynet.net> From: "Harun Bolat" <harunbolat@kaynet.net> Newsgroups: borland.public.interbase.sql References: <3df789da@newsgroups.borland.com> Subject: Re: left join in TIBDataSet Date: Wed, 11 Dec 2002 21:18:21 +0200 Lines: 31 Organization: Ak yaz�l�m X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 212.174.243.150 Message-ID: <3df78f42$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1039634242 212.174.243.150 (11 Dec 2002 11:17:22 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail