Pull out the SQL query to a separate template
Also switch datasources