fixed sql query for reindeer search