SELECT co.code
FROM warehouse w
JOIN address a ON a.id = w.addressFk
JOIN company co ON co.clientFk = a.clientFk
WHERE w.id = ?