RE: COUNT(*) with UNIQUE keyword
Posted in 1996
>
>
> How about:
>
> SELECT COUNT(distinct cartype_col) FROM cartype;>
> --Craig (craig@chemistry.utah.edu)
> >
> >[sample table deleted]
> >how would I count howmany cartype(S) that I have ...... (i.e. 2)
> >in 1 select statement...????
> >
>
Interesting that this should come up. I ran into this one recently, I
used to do this by SELECT UNIQUE xxx INTO TEMP xxx then check the
SQLCA.SQLERRD[3] value. Then I 'discovered' the COUNT(DISTINCT xxx) and
tried to replace my old code.... It hung. What? So I did some tests.
The SELECT UNIQUE xxx INTO TEMP xxx ran as fast or FASTER than the COUNT,
making the COUNT appear to hang because it took so long to return.
Others?
cheers
j.
_____________________________________________________________________________
Jack Parker - Hewlett Packard, DMD/IS Boise, Idaho, USA
jparker@hpbs3645.boi.hp.com
_____________________________________________________________________________
"I'm with the IRS, I'm here to help you"
_____________________________________________________________________________
Any opinions expressed herein are my own and not those of my employers.
_____________________________________________________________________________