Ver originalSELECT t1.id, CASE WHEN t2.id IS NULL THEN t1.cant ELSE t2.cant ENDFROM (SELECT id,COUNT(1)[cant] FROM tabla GROUP BY id) t1LEFT JOIN (SELECT * FROM tabla WHERE ul_me=-1) t2 ON t1.id=t2.id