Atrix,

Yes.

I presume you want to count distinct tranid's for each userno. If that's not 
what you want, explain again. Otherwise:

SELECT userno,  COUNT (*), COUNT (DISTINCT transid)
FROM users
WHERE type = 1
GROUP BY userno

Might give you what you want.  (Might even give you what you don't want, 
which is the middle COUNT (*), giving you exactly what you got with your 
COUNT (userno).

Bill

On Wed, 9 Jul 2003 15:12:35 -0700, Atrix Wolfe wrote:

>heya guys, i got an sql question
> 
>i have a table called users with a userno column, a tranid column and a
>type column
> 
>im trying to get the userno's and the count of the userno's from this
>table for type '1'.
> 
>i was doing this:
> 
>sel userno count(userno)
>from users
>where type=1
>group by userno
> 
>that works good however i want to make it only count distinct tranid's
>cause this is a summary of another peice of data which only shows
>distinct tranid's and it would be nice if they matched hehe (:
> 
>Is this possible with sql?
> 
>Thanks!
>Atrix

Reply via email to