SELECT stock_number,
p.itemid,
MAX(CASE WHEN p.pricegroup = 6 THEN price ELSE null END) 'Pounds Sterling',
MAX(CASE WHEN p.pricegroup = 10 THEN price ELSE null END) 'Euro',
MAX(CASE WHEN p.pricegroup = 2 THEN price ELSE null END) 'USD'
FROM iod_pricing p
INNER JOIN IOD_Items i ON p.itemid = i.itemid
WHERE p.pricegroup IN (2,6,10)
AND usergroupid = 0
GROUP BY stock_number, p.itemid, description
ORDER BY i.stock_number
-------------------------------------------------------------
stock_number Itemid Pounds Sterling Euro USD
57-264 15688 127.5 219.23 219.23
57-271 15680 NULL NULL 500
57-287 15708 2141.75 NULL 521
57-288 15709 NULL 520 123
57-289 15710 637.5 670 NULL
57-291 15712 637.5 820 820
|