Changed sql query.