SELECT COALESCE(ps.last_date, created) as last_update, ps.evidence, ps.id_status, s.status, s.n FROM pledge p LEFT JOIN pledge_status ps ON p.id_pledge = ps.id_pledge LEFT JOIN status s ON s.id_status= ps.id_status WHERE p.id_pledge = ? ORDER BY ps.last_date DESC, created LIMIT 1 SQLSTATE[HY093]: Invalid parameter number: no parameters were bound