MS SQL QUERY - ELIMINATE COL BUT GETTING DUPS

I am trying to select from two tables.. I have tried an inner join but I get four records for every one.  I need only records with null values in the VENDOR_PART_ID.. I am not sure why I am getting four records for each one.  Here are the queries.

SELECT     DEMAND_SUPPLY_LINK.ROWID, DEMAND_SUPPLY_LINK.ID, DEMAND_SUPPLY_LINK.DEMAND_TYPE, DEMAND_SUPPLY_LINK.DEMAND_BASE_ID, 
                      DEMAND_SUPPLY_LINK.DEMAND_LOT_ID, DEMAND_SUPPLY_LINK.DEMAND_SPLIT_ID, DEMAND_SUPPLY_LINK.DEMAND_SUB_ID, 
                      DEMAND_SUPPLY_LINK.DEMAND_SEQ_NO, DEMAND_SUPPLY_LINK.DEMAND_NO, DEMAND_SUPPLY_LINK.SUPPLY_TYPE, 
                      DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID, DEMAND_SUPPLY_LINK.SUPPLY_LOT_ID, DEMAND_SUPPLY_LINK.SUPPLY_SPLIT_ID, 
                      DEMAND_SUPPLY_LINK.SUPPLY_SUB_ID, DEMAND_SUPPLY_LINK.SUPPLY_SEQ_NO, DEMAND_SUPPLY_LINK.SUPPLY_NO, 
                      DEMAND_SUPPLY_LINK.WAREHOUSE_ID, DEMAND_SUPPLY_LINK.DEMAND_PART_ID, DEMAND_SUPPLY_LINK.SUPPLY_PART_ID, 
                      DEMAND_SUPPLY_LINK.ALLOCATED_QTY, DEMAND_SUPPLY_LINK.RECEIVED_QTY, DEMAND_SUPPLY_LINK.ISSUED_QTY, 
                      DEMAND_SUPPLY_LINK.SUPPLY_MODE, DEMAND_SUPPLY_LINK.CREATE_DATE, DEMAND_SUPPLY_LINK.USER_ID, DEMAND_SUPPLY_LINK.TYPE, 
                      DEMAND_SUPPLY_LINK.REALLOCATE, PURC_ORDER_LINE.PURC_ORDER_ID, PURC_ORDER_LINE.LINE_NO, PURC_ORDER_LINE.VENDOR_PART_ID
FROM         DEMAND_SUPPLY_LINK INNER JOIN
                      PURC_ORDER_LINE ON DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID = PURC_ORDER_LINE.PURC_ORDER_ID
WHERE     (DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID = 'P106708')

Open in new window


Gives me this :

15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL	P106708	1	NULL
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL	P106708	1	NULL
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL	P106708	1	NULL
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL	P106708	1	NULL
15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL	P106708	2	AQL SAMPLES
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL	P106708	2	AQL SAMPLES
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL	P106708	2	AQL SAMPLES
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL	P106708	2	AQL SAMPLES
15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL	P106708	3	PLATES
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL	P106708	3	PLATES
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL	P106708	3	PLATES
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL	P106708	3	PLATES
15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL	P106708	4	NULL
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL	P106708	4	NULL
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL	P106708	4	NULL
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL	P106708	4	NULL
15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL	P106708	5	AQL SAMPLES
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL	P106708	5	AQL SAMPLES
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL	P106708	5	AQL SAMPLES
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL	P106708	5	AQL SAMPLES
15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL	P106708	6	PLATES
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL	P106708	6	PLATES
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL	P106708	6	PLATES
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL	P106708	6	PLATES

Open in new window


But if I take out the PURCH_ORDER_LINE table :

SELECT     ROWID, ID, DEMAND_TYPE, DEMAND_BASE_ID, DEMAND_LOT_ID, DEMAND_SPLIT_ID, DEMAND_SUB_ID, DEMAND_SEQ_NO, DEMAND_NO, SUPPLY_TYPE, 
                      SUPPLY_BASE_ID, SUPPLY_LOT_ID, SUPPLY_SPLIT_ID, SUPPLY_SUB_ID, SUPPLY_SEQ_NO, SUPPLY_NO, WAREHOUSE_ID, DEMAND_PART_ID, 
                      SUPPLY_PART_ID, ALLOCATED_QTY, RECEIVED_QTY, ISSUED_QTY, SUPPLY_MODE, CREATE_DATE, USER_ID, TYPE, REALLOCATE
FROM         DEMAND_SUPPLY_LINK
WHERE     (SUPPLY_BASE_ID = 'P106708')

Open in new window


15146	14471	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	1	NULL	NULL	NUS285	NUS285	10368.0000	10368.0000	10368.0000	A	2013-08-08 15:22:10.043	BECKYG	NULL	NULL
15147	14472	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	2	NULL	NULL	NUS285	NUS285	176.0000	176.0000	176.0000	A	2013-08-08 15:22:10.113	BECKYG	NULL	NULL
15149	14474	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	4	NULL	NULL	NUS285	NUS285	9192.0000	5184.0000	5184.0000	A	2013-08-08 15:22:10.170	BECKYG	NULL	NULL
15148	14473	OP	13-0965	1	0	0	10	NULL	PO	P106708	NULL	NULL	NULL	5	NULL	NULL	NUS265	NUS285	264.0000	88.0000	88.0000	A	2013-08-08 15:22:10.143	BECKYG	NULL	NULL

Open in new window


In that all I want are lines 1 and 4.

Table Design

DEMAND_SUPPLY_LINK   ROWID                int                  4            0
DEMAND_SUPPLY_LINK   ID                   int                  4            0
DEMAND_SUPPLY_LINK   DEMAND_TYPE          varchar              2            0
DEMAND_SUPPLY_LINK   DEMAND_BASE_ID       varchar              30           0
DEMAND_SUPPLY_LINK   DEMAND_LOT_ID        varchar              15           1
DEMAND_SUPPLY_LINK   DEMAND_SPLIT_ID      varchar              3            1
DEMAND_SUPPLY_LINK   DEMAND_SUB_ID        varchar              3            1
DEMAND_SUPPLY_LINK   DEMAND_SEQ_NO        int                  4            1
DEMAND_SUPPLY_LINK   DEMAND_NO            int                  4            1
DEMAND_SUPPLY_LINK   SUPPLY_TYPE          varchar              2            0
DEMAND_SUPPLY_LINK   SUPPLY_BASE_ID       varchar              30           0
DEMAND_SUPPLY_LINK   SUPPLY_LOT_ID        varchar              15           1
DEMAND_SUPPLY_LINK   SUPPLY_SPLIT_ID      varchar              3            1
DEMAND_SUPPLY_LINK   SUPPLY_SUB_ID        varchar              3            1
DEMAND_SUPPLY_LINK   SUPPLY_SEQ_NO        int                  4            1
DEMAND_SUPPLY_LINK   SUPPLY_NO            int                  4            1
DEMAND_SUPPLY_LINK   WAREHOUSE_ID         varchar              15           1
DEMAND_SUPPLY_LINK   DEMAND_PART_ID       varchar              30           1
DEMAND_SUPPLY_LINK   SUPPLY_PART_ID       varchar              30           1
DEMAND_SUPPLY_LINK   ALLOCATED_QTY        decimal              9            0
DEMAND_SUPPLY_LINK   RECEIVED_QTY         decimal              9            0
DEMAND_SUPPLY_LINK   ISSUED_QTY           decimal              9            0
DEMAND_SUPPLY_LINK   SUPPLY_MODE          char                 1            0
DEMAND_SUPPLY_LINK   CREATE_DATE          datetime             8            0
DEMAND_SUPPLY_LINK   USER_ID              varchar              20           1
DEMAND_SUPPLY_LINK   TYPE                 char                 1            1
DEMAND_SUPPLY_LINK   REALLOCATE           char                 1            1

Open in new window


PURC_ORDER_LINE      ROWID                int                  4            0
PURC_ORDER_LINE      PURC_ORDER_ID        varchar              15           0
PURC_ORDER_LINE      LINE_NO              smallint             2            0
PURC_ORDER_LINE      PART_ID              varchar              30           1
PURC_ORDER_LINE      VENDOR_PART_ID       varchar              30           1
PURC_ORDER_LINE      SERVICE_ID           varchar              15           1
PURC_ORDER_LINE      USER_ORDER_QTY       decimal              9            0
PURC_ORDER_LINE      ORDER_QTY            decimal              9            0
PURC_ORDER_LINE      PURCHASE_UM          varchar              15           1
PURC_ORDER_LINE      UNIT_PRICE           decimal              9            0
PURC_ORDER_LINE      TRADE_DISC_PERCENT   decimal              5            0
PURC_ORDER_LINE      FIXED_CHARGE         decimal              9            1
PURC_ORDER_LINE      EST_FREIGHT          decimal              9            0
PURC_ORDER_LINE      GL_EXPENSE_ACCT_ID   varchar              30           1
PURC_ORDER_LINE      SALES_TAX_GROUP_ID   varchar              15           1
PURC_ORDER_LINE      PRODUCT_CODE         varchar              15           1
PURC_ORDER_LINE      COMMODITY_CODE       varchar              15           1
PURC_ORDER_LINE      DESIRED_RECV_DATE    datetime             8            1
PURC_ORDER_LINE      LINE_STATUS          char                 1            0
PURC_ORDER_LINE      LAST_RECEIVED_DATE   datetime             8            1
PURC_ORDER_LINE      TOTAL_ACT_FREIGHT    decimal              9            0
PURC_ORDER_LINE      TOTAL_USR_RECD_QTY   decimal              9            0
PURC_ORDER_LINE      TOTAL_RECEIVED_QTY   decimal              9            0
PURC_ORDER_LINE      TOTAL_AMT_RECVD      decimal              9            0
PURC_ORDER_LINE      TOTAL_AMT_ORDERED    decimal              9            0
PURC_ORDER_LINE      MFG_NAME             varchar              30           1
PURC_ORDER_LINE      MFG_PART_ID          varchar              30           1
PURC_ORDER_LINE      PROMISE_DATE         datetime             8            1
PURC_ORDER_LINE      PIECE_COUNT          decimal              9            1
PURC_ORDER_LINE      LENGTH               decimal              9            1
PURC_ORDER_LINE      WIDTH                decimal              9            1
PURC_ORDER_LINE      HEIGHT               decimal              9            1
PURC_ORDER_LINE      DIMENSIONS_UM        varchar              15           1
PURC_ORDER_LINE      VAT_CODE             varchar              15           1
PURC_ORDER_LINE      TOTAL_DISPATCH_QTY   decimal              9            0
PURC_ORDER_LINE      TOTAL_USR_DISP_QTY   decimal              9            0
PURC_ORDER_LINE      MINIMUM_CHARGE       decimal              9            1
PURC_ORDER_LINE      LAST_DISPATCH_DATE   datetime             8            1
PURC_ORDER_LINE      EDI_BLANKET_QTY      decimal              9            1
PURC_ORDER_LINE      EDI_BLANKET_USRQTY   decimal              9            1
PURC_ORDER_LINE      EDI_ACCUM_QTY_REL    decimal              9            1
PURC_ORDER_LINE      EDI_ACCUM_USR_REL    decimal              9            1
PURC_ORDER_LINE      EDI_ACCUM_QTY_REC    decimal              9            1
PURC_ORDER_LINE      EDI_ACCUM_USR_REC    decimal              9            1
PURC_ORDER_LINE      EDI_LAST_REC_DATE    datetime             8            1
PURC_ORDER_LINE      EDI_RELEASE_NO       varchar              30           1
PURC_ORDER_LINE      EDI_RELEASE_DATE     datetime             8            1
PURC_ORDER_LINE      EDI_QTY_RELEASED     decimal              9            1
PURC_ORDER_LINE      EDI_USR_QTY_REL      decimal              9            1
PURC_ORDER_LINE      EDI_REQ_REL_DATE     datetime             8            1
PURC_ORDER_LINE      SHIPTO_ID            varchar              20           1
PURC_ORDER_LINE      WAREHOUSE_ID         varchar              15           1
PURC_ORDER_LINE      WIP_VAS_REQUIRED     char                 1            1
PURC_ORDER_LINE      ALLOCATED_QTY        decimal              9            0
PURC_ORDER_LINE      FULFILLED_QTY        decimal              9            0
PURC_ORDER_LINE      HTS_CODE             varchar              20           1
PURC_ORDER_LINE      ORIG_COUNTRY_ID      varchar              50           1
PURC_ORDER_LINE      USER_1               varchar              80           1
PURC_ORDER_LINE      USER_2               varchar              80           1
PURC_ORDER_LINE      USER_3               varchar              80           1
PURC_ORDER_LINE      USER_4               varchar              80           1
PURC_ORDER_LINE      USER_5               varchar              80           1
PURC_ORDER_LINE      USER_6               varchar              80           1
PURC_ORDER_LINE      USER_7               varchar              80           1
PURC_ORDER_LINE      USER_8               varchar              80           1
PURC_ORDER_LINE      USER_9               varchar              80           1
PURC_ORDER_LINE      USER_10              varchar              80           1
PURC_ORDER_LINE      UDF_LAYOUT_ID        varchar              15           1
PURC_ORDER_LINE      vat_category         varchar              15           1
PURC_ORDER_LINE      VAT_AMOUNT           decimal              9            1
PURC_ORDER_LINE      VAT_RCV_AMOUNT       decimal              9            1
PURC_ORDER_LINE      WBS_CODE             varchar              30           1
PURC_ORDER_LINE      DEPARTMENT_ID        varchar              15           1
PURC_ORDER_LINE      PART_GL_ACCOUNT      varchar              30           1
PURC_ORDER_LINE      COST_CATEGORY_ID     varchar              15           1
PURC_ORDER_LINE      PROJ_REF_SEQ_NO      smallint             2            1
PURC_ORDER_LINE      PROJ_REF_SUB_ID      varchar              3            1
PURC_ORDER_LINE      DISPATCH_ADDR_ID     varchar              20           1
PURC_ORDER_LINE      SHIPFROM_ID          varchar              20           1
PURC_ORDER_LINE      QA_QTY               decimal              9            1
PURC_ORDER_LINE      OWNER_ID             varchar              15           1
PURC_ORDER_LINE      TRACE_QTY            decimal              9            1
PURC_ORDER_LINE      DISPATCHED           char                 1            1
PURC_ORDER_LINE      TRANS_CATEGORY_ID    varchar              15           1
PURC_ORDER_LINE      ORIG_STAGE_REVISION_ID varchar              24           1
PURC_ORDER_LINE      CONSIGNED_WHS_ID     varchar              15           1
PURC_ORDER_LINE      CONSIGNED_LOC_ID     varchar              15           1
PURC_ORDER_LINE      STATUS_EFF_DATE      datetime             8            0
PURC_ORDER_LINE      PROMISE_SHIP_DATE    datetime             8            1
PURC_ORDER_LINE      SPECIAL_PRICE_AUTH   varchar              100          1
PURC_ORDER_LINE      CONTRACT_ID          varchar              30           1
PURC_ORDER_LINE      CONTRACT_LINE_NO     smallint             2            1

Open in new window

LVL 24
DMTechGrooupAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chaauCommented:
It looks like joining by DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID = PURC_ORDER_LINE.PURC_ORDER_ID is not the right way. I can see that in the original query all 4 records has the same SUPPLY_BASE_ID. I can see, however that there is a SUPPLY_SEQ_NO that has values 1 to 4. So, this column needs to be joined as well. I think, LINE_NO is a good candidate for joining. Try this query:
SELECT     DEMAND_SUPPLY_LINK.ROWID, DEMAND_SUPPLY_LINK.ID, DEMAND_SUPPLY_LINK.DEMAND_TYPE, DEMAND_SUPPLY_LINK.DEMAND_BASE_ID, 
                      DEMAND_SUPPLY_LINK.DEMAND_LOT_ID, DEMAND_SUPPLY_LINK.DEMAND_SPLIT_ID, DEMAND_SUPPLY_LINK.DEMAND_SUB_ID, 
                      DEMAND_SUPPLY_LINK.DEMAND_SEQ_NO, DEMAND_SUPPLY_LINK.DEMAND_NO, DEMAND_SUPPLY_LINK.SUPPLY_TYPE, 
                      DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID, DEMAND_SUPPLY_LINK.SUPPLY_LOT_ID, DEMAND_SUPPLY_LINK.SUPPLY_SPLIT_ID, 
                      DEMAND_SUPPLY_LINK.SUPPLY_SUB_ID, DEMAND_SUPPLY_LINK.SUPPLY_SEQ_NO, DEMAND_SUPPLY_LINK.SUPPLY_NO, 
                      DEMAND_SUPPLY_LINK.WAREHOUSE_ID, DEMAND_SUPPLY_LINK.DEMAND_PART_ID, DEMAND_SUPPLY_LINK.SUPPLY_PART_ID, 
                      DEMAND_SUPPLY_LINK.ALLOCATED_QTY, DEMAND_SUPPLY_LINK.RECEIVED_QTY, DEMAND_SUPPLY_LINK.ISSUED_QTY, 
                      DEMAND_SUPPLY_LINK.SUPPLY_MODE, DEMAND_SUPPLY_LINK.CREATE_DATE, DEMAND_SUPPLY_LINK.USER_ID, DEMAND_SUPPLY_LINK.TYPE, 
                      DEMAND_SUPPLY_LINK.REALLOCATE, PURC_ORDER_LINE.PURC_ORDER_ID, PURC_ORDER_LINE.LINE_NO, PURC_ORDER_LINE.VENDOR_PART_ID
FROM         DEMAND_SUPPLY_LINK INNER JOIN
                      PURC_ORDER_LINE ON DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID = PURC_ORDER_LINE.PURC_ORDER_ID AND DEMAND_SUPPLY_LINK.SUPPLY_SEQ_NO = PURC_ORDER_LINE.LINE_NO
WHERE     (DEMAND_SUPPLY_LINK.SUPPLY_BASE_ID = 'P106708')

Open in new window

Also, if you need the records with a NULL VENDOR_PART_ID, add this right before your WHERE clause:
AND PURC_ORDER_LINE.VENDOR_PART_ID IS NULL

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DMTechGrooupAuthor Commented:
Awesome thanks, worked like a charm..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.