COUNT(DISTINCT [fieldName] is very important to remember when using JOINS.  For 
example, if you have the query...

SELECT COUNT(A.code) AS total
FROM TableA A INNER JOIN TableB ON A.code = B.code

And you wanted to know how many records in TableA have records in TableB.

If this query returns 10 records, there may only be 3 DISTINCT records returned 
from TableA.  If you use COUNT(A.code) as written above, the result will be 10. 
 If you change it to COUNT(DISTINCT A.code), you will get your desired answer 
of 3.

>Interesting ... COUNT(DISTINCT prodcode) will work, huh?  That may come in 
>handy some day.  Thanks! 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320558
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to