On Thu, May 15, 2008 at 12:00 AM, <[EMAIL PROTECTED]> wrote: > Hi, > > select count(distinct(j.JOBID)) as jobCount > from JOB_TYPE_FIRST a, JOB_TYPE_SECOND b, JOB_ALLOCATION_WORKLIST j > where (( a.JOBID = j.JOBID) > and (a.BOOK_ID = :bookId)) > or ((b.JOBID = j.JOBID) > and (b.BOOK_ID = :bookId));
Have you tried joining a with j and b with j separately, and then doing a union on those two sets? -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql