Details
-
Question
-
Status: Resolved
-
Minor
-
Resolution: Invalid
-
2.4.3
-
None
-
None
Description
Hello Community,
My first post here, so please forgive me if I'm not following protocol.
I'm trying to run the following code, however I keep on getting the error
Invalid number of arguments for function add_months. Expected: 2; Found: 1;
Even though, I certain I have two arguments.
Can someone take a look at the code and let me know where I might be going wrong.
test5 = spark.sql("""SELECT
TRX_EVENT_END AS TRX_EVENT
,SALES_QUANTITY
FROM Transactions
WHERE TRX_EVENT_END BETWEEN CAST(YEAR(DATE_ADD(CURRENT_DATE(),-1)) AS CHAR(4))+ RIGHT('0' + CAST(ADD_MONTHS(DATE_ADD(CURRENT_DATE(),-1))AS VARCHAR(2)),2) + '01'AND LAST_DAY(DATE_ADD(CURRENT_DATE(),-1))""")
Thanks
Carlton