change sql query to fetch feeds