Actually, if you're using SQL server, this might work:

select count(*) from (put all your SQL in here without the count(), just the 
select distinct....)

that might do it.

-----Original Message-----
From: RADEMAKERS Tanguy [mailto:[EMAIL PROTECTED]
Sent: Friday, August 26, 2005 11:02 AM
To: CF-Talk
Subject: RE: SQL Count Question...


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
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:216496
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=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to