SELECT t.id, t.clientFk, cty.country, w.name AS warehouse FROM ticket t JOIN warehouse w ON w.id = t.warehouseFk JOIN address a ON a.id = t.addressFk JOIN province p ON p.id = a.provinceFk JOIN autonomy au ON au.id = p.autonomyFk JOIN country cty ON cty.id = au.countryFk WHERE t.id = ?