I'm not sure if the Pivot clause can do this but thought I'd throw a question out before I pull my hair out.
Table
Location ItemCode Qty
CAL ABC 2
HAL ABC 3
REG ABC 1
CAL XYZ 5
REG XYZ 4 (notice htat HAL does not have qty of XYZ)
I would like a simple result set with the following columns: ItemCode, QtyCAL, QtyHAL, QTYREG
Results:
ItemCode, QtyCAL, QtyHAL, QTYREG
ABC 2 3 1
XYZ 5 NULL 4
ABC
Table
Location ItemCode Qty
CAL ABC 2
HAL ABC 3
REG ABC 1
CAL XYZ 5
REG XYZ 4 (notice htat HAL does not have qty of XYZ)
I would like a simple result set with the following columns: ItemCode, QtyCAL, QtyHAL, QTYREG
Results:
ItemCode, QtyCAL, QtyHAL, QTYREG
ABC 2 3 1
XYZ 5 NULL 4
ABC