SELECT Partnumber, MAX(PO)
FROM MyTable t1
WHERE NOT EXISTS (SELECT 1
FROM MyTable
WHERE (Receipt <> '0'
OR Receipt <> '')
AND Partnumber = t1.partnumber)
GROUP BY PartNumber