Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 88992 invoked from network); 2 Mar 2009 13:27:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 2 Mar 2009 13:27:28 -0000 Received: (qmail 59098 invoked by uid 500); 2 Mar 2009 13:27:28 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 59079 invoked by uid 500); 2 Mar 2009 13:27:27 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 59068 invoked by uid 99); 2 Mar 2009 13:27:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Mar 2009 05:27:27 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.24.207.26] (HELO mail.seitenbau.net) (217.24.207.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 02 Mar 2009 13:27:21 +0000 Received: from [192.168.15.18] (helo=www.seitenbau.net) by router.seitenbau.net with esmtp (Exim 4.43) id 1Le8AT-0000bU-3A for torque-user@db.apache.org; Mon, 02 Mar 2009 14:26:50 +0100 In-Reply-To: <002101c99b37$3cdc31e0$b69495a0$@com> References: <002101c99b37$3cdc31e0$b69495a0$@com> To: "Apache Torque Users List" MIME-Version: 1.0 Subject: RE: Multiple addJoin with OR X-KeepSent: 93F675E9:2B4FDFE3-C125756D:0049837E; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.0.2 August 07, 2008 Message-ID: From: Thomas Fischer Date: Mon, 2 Mar 2009 14:26:48 +0100 X-MIMETrack: Serialize by Router on www/seitenbau(Release 8.0.1|February 07, 2008) at 02.03.2009 14:26:48, Serialize complete at 02.03.2009 14:26:48 Content-Type: multipart/alternative; boundary="=_alternative 0049DD71C125756D_=" X-Spam-Score: -1.4 (-) X-Spam-Report: -1.4 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 0049DD71C125756D_= Content-Type: text/plain; charset="US-ASCII" > I want to create an SQLQuery that combines data from three tables. Right > now, my javacode looks like this: > > Criteria.addJoin(TableA.id, TableB.fk); > Criteria.addJoin(TableA.id, TableC.fk); > > This results in this SQL query: > > WHERE TableA.id = TableB.fk > > AND TableA.id = TableC.fk > > However, this is not the result I need. What I need is a query with OR > instead of AND, like this: > > WHERE TableA.id = TableB.fk > > OR TableA.id = TableC.fk > > I haven't found any way to do this using criteria. Is it possible? I do not know a way to do this currently. But are you really sure your statement makes sense ? If one row in table B matches, then you get all rows of table C joined (or vice versa), and I cannot imagine this is what you need. But I might be wrong. Thomas --=_alternative 0049DD71C125756D_=--