1

I got the following error in big query when running the following code in standard SQL:

SELECT 
    DATE(DATE_ADD(TIMESTAMP("2017-10-01"), pos - 1, "DAY")) AS selected_date
FROM
    (SELECT 
         ROW_NUMBER() OVER() AS pos, *
     FROM 
         (FLATTEN((SELECT SPLIT(RPAD('', 1 + DATEDIFF(TIMESTAMP(CURRENT_DATE()), TIMESTAMP("2017-10-01")), '.'),'') AS h
     FROM (SELECT NULL)),h
     )))

Error:

Syntax error: Expected keyword JOIN but got ")" at [7:7]

Can anyone convert this to standard SQL?

1 Answer 1

3
#standardSQL
SELECT d AS selected_date
FROM UNNEST(GENERATE_DATE_ARRAY("2017-10-01", CURRENT_DATE())) d
Sign up to request clarification or add additional context in comments.

1 Comment

great. if not yet - consider voting up :o)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.