Let me see if I understand this correctly. You want to join the order table to the customer table and get the "sold-to" customer name as well as the "bill-to" customer name, right?

Assuming this is the case, you'll need to join to the customer table twice.

SELECT
A.ORDER_NO,
A.SOLD_TO_CUST_ID,
B1.NAME1 AS SOLD_TO_CUST_NAME,
A.BILL_TO_CUST_ID,
B2.NAME1 AS BILL_TO_CUST_NAME,
A.ORDER_GRP
FROM
PS_ORD_HEADER A,
PS_CUSTOMER B1,
PS_CUSTOMER B2
WHERE
A.ORDER_NO = '...' AND
A.SOLD_TO_CUST_ID = B1.CUST_ID AND
A.BILL_TO_CUST_ID = B2.CUST_ID

HTH.

At 02:05 PM 11/27/2002 -0600, Casey Crookston wrote:
SELECT
        A.ORDER_NO,
        A.SOLD_TO_CUST_ID,
        B.NAME1(1),
        A.BILL_TO_CUST_ID,
        B.NAME1(2),
        A.ORDER_GRP,
FROM
        PS_ORD_HEADER A,
        PS_CUSTOMER B
WHERE
        A.ORDER_NO = 'OE-1062283'
        AND
        ?? A.SOLD_TO_CUST_ID = B.CUST_ID ??
::::::::::::::::::::::::::::::::::
Howard Cheng
http://www.howcheng.com/
howcheng at ix dot netcom dot com
AIM: bennyphoebe
ICQ: 47319315


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] Send Your Posts To: [EMAIL PROTECTED]
To change subscription settings to the wdvltalk digest version:
http://wdvl.internet.com/WDVL/Forum/#sub

________________ http://www.wdvl.com _______________________

You are currently subscribed to wdvltalk as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]


Reply via email to