fixed last sql query modification for RTStats