I don't know about sql server specifically, but you could try syntax
like

select count(distinct(mycolumn)) from mytable

or else you should be able to do

select count(*) from (select distinct(mycolumn) from mytable)

/t

>-----Original Message-----
>Subject: SQL Count Question...
>From: <[EMAIL PROTECTED]>
>Date: Fri, 26 Aug 2005 07:16:33 -0500
>Thread: 
>http://www.houseoffusion.com/cf_lists/index.cfm/method=messages
>&threadid=41929&forumid=4#216470
>
>I don't think you can use DISTINCT with an aggregate function 
>like count().  Also, you didn't indicate anywhere in this 
>e-mail which database server you're using.  
>
>Are you doing the query just to get the count, or is it for 
>some other purpose as well.  There's nothing wrong with using 
>#queryname.recordcount#.  You could do the count() without the 
>DISTINCT, but that may give you more than you are looking for.  
>
>Maybe you could tell us the goal you're trying to accomplish 
>and there might be another way to approach it.  Be sure to 
>include your SQL database type and version.  Also, providing 
>your error message is very helpful.
>
>Dave
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216494
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to