November 18, 2014 at 1:09 am
SELECT DISTINCT(USER_ID) FROM marketing_dataset WHERE EMAIL_CAMPAIGN IN (SELECT TOP 1 with ties SUM(REGISTER_WEBINAR)/COUNT(DISTINCT (USER_ID)) AS CONV,EMAIL_CAMPAIGN
FROM marketing_dataset
GROUP BY EMAIL_CAMPAIGN
ORDER BY CONV DESC)
How to get rid of the error "Only one expression can be specified in the select list when the subquery is not introduced with EXISTS." ? I am trying to execute the above query.
November 18, 2014 at 1:27 am
Ditch the aggregate. You are returning two columns in the subquery, while you can have only one in an IN clause.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 18, 2014 at 1:35 am
SELECT DISTINCT(USER_ID) FROM marketing_dataset WHERE EMAIL_CAMPAIGN IN
(SELECT TOP 1 WITH TIES EMAIL_CAMPAIGN
FROM marketing_dataset
GROUP BY EMAIL_CAMPAIGN
ORDER BY SUM(REGISTER_WEBINAR)/COUNT(DISTINCT (USER_ID)) DESC)
Thanks a lot man, You guided me to solve the puzzle I had been dealing with for the last few hours. It makes sense now 🙂
November 18, 2014 at 1:41 am
OK, great you solved your issue and thanks for posting back.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply