Comment Comment by wesd That example code seems overly complicated and redundant. Should the code be simpler like this: SELECT id , max(a) ma , count(*) Cnt FROM ... GROUP BY id parent wesd 8 years ago