From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,333d8690b2d403e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.211.136 with SMTP id nc8mr2572310pbc.6.1335166407204; Mon, 23 Apr 2012 00:33:27 -0700 (PDT) Path: r9ni88431pbh.0!nntp.google.com!news1.google.com!news.glorb.com!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Mon, 23 Apr 2012 09:33:26 +0200 From: =?UTF-8?B?VGhvbWFzIEzDuGNrZQ==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120403 Thunderbird/11.0.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: GNATCOLL.SQL.SQL_Select - I'm in Left_Join hell References: <4f90233d$0$282$14726298@news.sunsite.dk> <82vckti989.fsf@stephe-leake.org> In-Reply-To: <82vckti989.fsf@stephe-leake.org> Message-ID: <4f9505c6$0$285$14726298@news.sunsite.dk> Organization: SunSITE.dk - Supporting Open source NNTP-Posting-Host: 77.234.168.91 X-Trace: news.sunsite.dk DXC=OFDLHEaEG^_PJU4WZUlGaXYSB=nbEKnk[BeI;]CeQ6;T3ZOKe3?:>XQcAE?;m5ccYS3>^Oo7SF On 04/21/2012 02:02 PM, Stephen Leake wrote: > You could do each Left join in separate statements before the > SQL_Select, and pass the final table to SQL_Select. > > or use named association to reorder the lines: > > Left_Join > (Full => Organization, > On => Organization.Org_Id = Contactentity_Organization.Org_Id, > Partial => Left_Join > (Full => Contactentity_Organization, > On => Contactentity.Ce_Id = Contactentity_Organization.Ce_Id, > Partial => Left_Join > (Full => Contactentity, > On => Contactentity.Ce_Id = Contactentity_Tag.Ce_Id, > Partial => Left_Join > (Contactentity_Tag, > Tag, > Tag.Tag_Id = Contactentity_Tag.Tag_Id)))), > > I don't like the 'full' and 'partial' names, but this looks a little better. > I ended up with this: https://gist.github.com/2469364 Which is good enough. I can read it, and I can reuse the JOIN's in other queries. So all in all it ended pretty well. :o) -- Thomas Løcke | thomas@12boo.net | http://12boo.net