Ver originalSELECT tt.foo, COUNT( tt.foo ) counterFROM test tINNER JOIN test tt ON tt.foo = t.fooWHERE t.closed =0AND DATE_FORMAT( t.created_datetime, "%Y-%m-%d" ) <= NOW( ) - INTERVAL -3DAY GROUP BY tt.fooLIMIT 0 , 30