aggregation and delete query