'How do I select distinct count over multiple columns?

How to select distinct count over multiple columns?

SELECT COUNT(DISTINCT col1, col2, col3) FROM table; 

Is there a working equivalent of this in DB2?



Solution 1:[1]

select count(distinct col1 || '^' || col2 || '^' || col3) from table

to avoid problems during concatenation like between 1 || 11 which would be the same as 11 || 1.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Burkhard Lau