Article View: borland.public.interbase.sql
Article #11029Re: Join on Interbase
From: Dan Palley
Date: Thu, 26 Dec 2002 23:42
Date: Thu, 26 Dec 2002 23:42
37 lines
2209 bytes
2209 bytes
Basically, you're combining values from two tables (ACCOUNTS and ROLES) into a single result set. The relationship between the two tables is based on user_id. Since you're doing a left join, records in ACCOUNTS with no corresponding ROLES records will still be included in the result set. The Interbase Data Definition Guide goes into great detail on the syntax of the JOIN statement. Since Interbase syntax is fairly vanilla SQL-92, most SQL books are applicable as well (I recommend SQL for Smarties by Joe Celko). Dan "The DeerBear" <rainaple@tin.it> wrote in message news:3e0b8c13@newsgroups.borland.com... > Hello, > > Lurking in this group, I came up with this query: > > Select ACCOUNTS.LAST_NAME,ACCOUNTS.first_name, ROLES.user_role FROM ACCOUNTS > ACC Left Outer Join ROLES R ON R.user_id = Acc.user_id . > > I made it work as expected, but there's a small prob... I have NO clue about > why it > worked... <G> > > I explain: I managed to make it work, but I'm totally clueless on how joins > work... > would any pietous soul explain me what that SQL statement means? > > TIA > > Andrew > >
Technical Details
Message-ID:
<3e0b9474$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!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!amsnews01.chello.com!news-hub.cableinet.net!blueyonder!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3e0b8c13@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,fa51700038f7b6f2 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-26 16:06:27 PST From: "Dan Palley" <dan@trams.com> Newsgroups: borland.public.interbase.sql References: <3e0b8c13@newsgroups.borland.com> Subject: Re: Join on Interbase Date: Thu, 26 Dec 2002 15:42:39 -0800 Lines: 39 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 157.238.54.68 Message-ID: <3e0b9474$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1040946292 157.238.54.68 (26 Dec 2002 15:44:52 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!amsnews01.chello.com!news-hub.cableinet.net!blueyonder!nntp2.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail