You could try count(distinct emailID). On Wed, May 6, 2009 at 8:42 AM, Jason Fisher <ja...@wanax.com> wrote: > > Try a sub-query. Pretty sure this will get you what you're looking for (or > close): > > SELECT sub.thisCount, > sub.emailID, > e.emailAddress > sub.emailDate, > sub.groupID > FROM log_email e RIGHT OUTER JOIN > ( > SELECT COUNT(emailAddress) AS thisCount, > emailID, > emailDate, > groupID > FROM log_email > GROUP BY emailID, groupID, emailDate > ) AS sub ON e.emailID = sub.emailID > WHERE sub.emailID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" > value="#trim(url.emailID)#" /> > ORDER BY sub.emailDate DESC > > >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:322221 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4