Note: This is not a generic solution. Adjust the order by clause of rank to get the desired result
SELECT personid, MAX(company) AS company1, MIN (company) as company2
FROM (
SELECT RANK() OVER(PARTITION BY personid ORDER BY company) rnk, personid, company
FROM persons ) p
WHERE rnk IN (1, 2)
GROUP BY personid