Aggregates working version (without HAVING and DATA types limitations)