I need to do a count on distinct of multiple columns with case condition I already know the answer given here if I have just 1 column. But if I have multiple columns as follows:
SELECT COUNT(DISTINCT (CASE WHEN CustomerId > 10 THEN CITY,COUNTRY END))
FROM Customers;
The error I get is
Error 1: could not prepare statement (1 near ",": syntax error)
THEN CITY,COUNTRY ENDwhich, AFAIK isn't accepted. You need to use a work around for that. Either duplicate the case, on for each cit or simply use awherecondition and a group by.