select a,b,c,d,count(*) from x group by a,b,c,d