首页 > 解决方案 > Why am I receiving an Error 2F0F5E42 (Missing Parenthesis) in my SQL script when it appears they are all present?

问题描述

We recently updated our Tableau Server to 2021.1.5 and started noticing an error for the following script that was written for us; Error Code 2F0F5E42 - Missing Right Parenthesis. I'm so-so when it comes to SQL so I loaded the SQL script into Sublime and looked for any errors. I could not see any missing parenthesis and it looks like everything should run fun; however, I'm not familiar with using SQL in Tableau.

I was told when they originally ran the script in Tableau they were getting an issue with the date and they changed something in the table for the data and now it's showing the Missing Right Parenthesis. I know that Tableau has some issues with some of the SQL languages so I'm not sure if I shouldn't be including more () in some places.

SELECT A.rate,
       A.class,
       Count(DISTINCT A.mbrsep),
       Sum(B.totalenergy)
FROM V_MV_CA_MEMBERDETL A
INNER JOIN mdmrpt.DAILY_USAGE B ON A.METER=B.METER
WHERE (A.cycle = 0001
       OR A.cycle = 0002
       OR A.cycle = 0003
       OR A.cycle = 0004)
  AND B.dailytimestamp BETWEEN to_date(TO_DATE('<Parameters.Year>-<Parameters.Month>-01', 'YYYY-MM-DD')) AND to_date(<Parameters.End Date>)
  OR (A.cycle = 0006
      OR A.cycle = 0007
      OR A.cycle = 0008)
AND A.mbrsep in
    (SELECT C.mbrsep
     FROM V_MV_CA_MEMBERDETL C
     INNER JOIN mdmrpt.DAILY_USAGE D ON C.METER=D.METER
     WHERE D.dailytimestamp = to_date(<Parameters.End Date>))
GROUP BY rate

标签: sqlsubquerytableau-apitableau-desktop

解决方案


推荐阅读