Update StatisticsDAO implementation to make the native queries compatible with mysql and postgres