include having in sql template