I am trying to solve the issue mismatched input ')' expecting ',', but cannot guess, what went wrong. I have read all documentation, cannot find where I am missing the comma, becasue databricks says "Error in SQL statement: ParseException: mismatched input ')' expecting ','(line 2, pos 108)":
select
(CASE WHEN (fdse.`eventaction` IN ('zoom image')) THEN sum(CAST(fdse.`totalevents` AS
BIGINT)) END AS `zoom`)
from GA_FAVORITES_DIGITAL_STYLIST_EVENTS as fdse
inner join GA_FAVORITES_SESSIONS as fs
on fdse.uniquesessionid = fs.uniquesessionid
and fdse.trans_date = fs.trans_date
where fs.trans_date >= date_add(current_date,-10)
limit 10
CodePudding user response:
The issue might be because the AS
is inside of the parentheses. Try this and let me know if it works:
SELECT
(CASE WHEN (fdse.`eventaction` IN 'zoom image') THEN SUM(CAST(fdse.`totalevents` AS BIGINT)) END) AS `zoom`
FROM GA_FAVORITES_DIGITAL_STYLIST_EVENTS AS fdse
INNER JOIN GA_FAVORITES_SESSIONS AS fs
ON fdse.uniquesessionid = fs.uniquesessionid
AND fdse.trans_date = fs.trans_date
WHERE fs.trans_date >= date_add(current_date, -10)
LIMIT 10
Sometimes SQL errors can be misleading!