Added query to DB to obtain all the records of the ranking template