What do you are trying to do?
Like Arthur said, you can't do what you did.
Maybe you need something like:
select column1, count(distinct column1) from table_name
union
select column2, count(distinct column2) from table_name
union
select column3, count(distinct column3) from table_name
But this should work only if that 3 columns have the same type
Main Topics
Browse All Topics





by: Arthur_WoodPosted on 2005-05-06 at 04:18:28ID: 13943961
you can't use Distinct with three columns like that. What are you trying to count? You want to count the distinct COMBINATION of the three Columns, is that what you are after?
Although this applies to SQL Server, I think it is SQL Standard - across all databases:
"If you use DISTINCT, the expression must consist of a column name only. It cannot include an arithmetic expression"
AW