Skip to main content

A follow up to my previous post:  Using multiple CTEs in Tableau | Salesforce Trailblazer Community

 

 

I now have to add 2 temporary variables, a start_date and end_date.  The code works w/ 1 temporary variable but fails when I add a second temporary variable.  The error message I receive says  

 

Actual statement count 3 did not match the desired statement count 1. 

Initial SQL Error. Check that the syntax is correct and that you have access privileges to the requested database. 

 

This is my code.  Would appreciate any help.  Thank you!

 

SET START_DATE = '2026-08-31'::DATE;

SET END_DATE = '2026-09-05'::DATE;

 

CREATE TEMPORARY TABLE AAAA_DB.AAAA_TB.test1 AS 

 

WITH RECURSIVE

business_dates (business_date) AS (

    SELECT $BUSINESS_START_DATE::DATE

    UNION ALL

    SELECT DATEADD(day, 1, business_date)

    FROM business_dates

    WHERE business_date < $BUSINESS_END_DATE::DATE

),

followed by multiple CTEs

 

#Tableau Desktop & Web Authoring

1 个回答
  1. 9月27日 12:27

    @Luciana Suran Hi, thanks for your posting. What is your goal here? Could you try using paratemer for your variables, so in your case will be 2 parameters  start_date and end_date with the correct date field type which will pass the parameter value to your database.

0/9000