🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #357

Novice SQL question

#357
From: TerryC
Date: Wed, 02 Apr 2008 14:51
22 lines
1643 bytes
Here's the query I have created so far:

select *
from eps_order_items OI
    join eps_order_dates OD on OD.ORDER_ITEM_ID = OI.ORDER_ITEM_ID
    join eps_requisition_order RO on RO.ORDER_SCHEDULE_ID = OD.ORDER_SCHEDULE_ID
    join eps_requisition_details RD on RD.REQUISITION_ITEM_ID = RO.REQUISITION_ITEM_ID
    join (  select sir_no || req_no as REQ_ID, WORK_ORDER_NO
            from ewm_wo_parts
            where sir_no is not null or req_no is not null
         ) WP on WP.REQ_ID = RD.EXT_REQ_ID

The last JOIN is to a sub-query so I can combine the values of
two fields into one.  The desired data is either in one field
or the other, but never in both, and they are equivalent data
types.

Is that the way to go, or is there a better way?

It seems to be producing a Cartesian product or something...
(Many more results when the last JOIN was added.)
Technical Details
Message-ID: <47f39d8f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.isoc.lu!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,95ac3f45170c33fc,start
X-Google-Attributes: gid114a0e,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "TerryC" <user@server.net>
Sender: "TerryC" <user@server.net>
Reply-To: "TerryC" <user@server.net>
Subject: Novice SQL question
Newsgroups: borland.public.interbase.sql
X-User-Info: 205.247.207.210     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <47f39d8f$1@newsgroups.borland.com>
Date: 2 Apr 2008 07:51:59 -0700
X-Trace: newsgroups.borland.com 1207147919 207.105.83.66 (2 Apr 2008 07:51:59 -0700)
Lines: 22
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!news.isoc.lu!newsgroups.borland.com!not-for-mail