Código SQL [-]select * from ticket order by referencia desc Limit 1;
select * from ticket order by referencia desc Limit 1;