Fix type in sql template query