Re: distinct function syntax question
Posted in 1997
Andre da Silva Nazare — — source: Informix-list mailing list archive (1991-1998)
Try using this :
select 1
from table_x
group by col1,col2 into temp temp_table;
select count(*) from temp table;
This could be quite fast, depending on an index on col1,col2
and the size of the table.
Ps. Don't forget that the temp table will exist until your
session ends or you drop it.
> Andy Capps wrote:
> I'd like to perform the query: "select count (distinct
> col1, col2)" but I
> get a syntax error. I also get a syntax error from
> "select count
> (distinct col1 || col2)". How do I perform such a query?
> I am able to
> perform the query using the second syntax in Sybase but
> I'm guessing
> there isn't a similar way to do this in Informix.
>
> Thanks,
> Kyle