The ORG_ITEM table contains duplicate IDs. These ids show different MFR and PART_NO for the same ID. This results in my query returning multiple rows with the same ID. How can I get those rows into a single row with each MFR and PART_NO as a separate column?
SELECT
PART_LOC.CLASS,
PART_LOC.ID,
ORG.MFR,
ORG_ITEM.PART_NO,
PART_LOC.STORAGE_LOC,
PART_LOG.QTY,
COST.UNIT_COST
FROM
PART_LOC
LEFT JOIN COST on PART_LOC.ID = COST.ID
LEFT JOIN ORG_ITEM on PART_LOC.ID = ORG_ITEM.ID
LEFT JOIN ORG on ORG_ITEM.MFR = ORG.MFR
WHERE
PART_LOC.STORAGE_LOG = :Facility
Currently returns:
CLASS ID MFR PART_NO STORAGE_LOC QTY COST
3 1234 Grainger 123F6 CRIB 6 12.67
3 1234 Hagerty asd45 CRIB 6 12.67
3 1234 MSC poi98 CRIB 6 12.67
Want it to return:
CLASS ID MFR-PART_NO1 MFR-PART_NO2 MFR-PART_NO3 STORAGE_LOC QTY COST
3 1234 Grainger-123F6 Hagerty-asd45 MSC-poi98 CRIB 6 12.67