SQL Server 2000 SP2
Working an a query to extract item master data, where tables include item master Table A, item location Table B, item UOM Table C, all to be joined together.
All item have one master record, so (1) record in Table A
All items have (3) locations, so three records in Table B.
All tems have (2) UOMs. Sometimes the upms are different, sometimes there are the same.
*ex: item "ABC" has 2 uoms, Each and Case
item "DEF" has 2 uoms, Each and Each
Desired result should (6) records, not (12), (3) for each item # by Location 1, 2, 3, with the two UOMs displayed in separate columns;
ITEM# LOCATION UOM1 UOM2
ABC Loc 1 EACH Case
ABC Loc 2 EACH Case
ABC Loc 3 EACH Case
DEF Loc 1 EACH EACH
DEF Loc 2 EACH EACH
DEF Loc 3 EACH EACH
Challenge is with items that have the same UOM for both uom schedules, such as item "DEF" above.
There is a numeric key field in the UOM Table, Table C, that is always least for the first record, so I thought I could use that value to determine which value populates Columns UOM1 and UOM2.
However, I don't know how to programtically do that.
Appreciate help in accomplishing this query and results.
Thanks,
awaria
Working an a query to extract item master data, where tables include item master Table A, item location Table B, item UOM Table C, all to be joined together.
All item have one master record, so (1) record in Table A
All items have (3) locations, so three records in Table B.
All tems have (2) UOMs. Sometimes the upms are different, sometimes there are the same.
*ex: item "ABC" has 2 uoms, Each and Case
item "DEF" has 2 uoms, Each and Each
Desired result should (6) records, not (12), (3) for each item # by Location 1, 2, 3, with the two UOMs displayed in separate columns;
ITEM# LOCATION UOM1 UOM2
ABC Loc 1 EACH Case
ABC Loc 2 EACH Case
ABC Loc 3 EACH Case
DEF Loc 1 EACH EACH
DEF Loc 2 EACH EACH
DEF Loc 3 EACH EACH
Challenge is with items that have the same UOM for both uom schedules, such as item "DEF" above.
There is a numeric key field in the UOM Table, Table C, that is always least for the first record, so I thought I could use that value to determine which value populates Columns UOM1 and UOM2.
However, I don't know how to programtically do that.
Appreciate help in accomplishing this query and results.
Thanks,
awaria