Re: distinct function syntax question
Posted in 1997
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
Gert Brinkmann wrote:
>
> Andre da Silva Nazare wrote:
> >
> > Try using this :
> >
> > select 1
> > from table_x
> > group by col1,col2 into temp temp_table;> >
> > select count(*) from temp table;>
> Couldn't it be this shorter way ?
>
> select count(*)
> from table_x
> group by col1,col2;
No standard SQL, and Informix, require that the grouped by columns be
selected in the query so this is a syntax error. Besides your query
would return one count of the number of rows containing each pair of
col1, col2 for each pair not a single count of the number of unique
pairs, even in a database like Sybase which permits this syntax.
Art S. Kagel