does your db support CASE WHEN THEN END flow control statements? Azadi Saryev Sabai-dee.com http://www.sabai-dee.com/
Walter Conti wrote: > Need to modify the following query so that > sum(a.msgcount) AS msgs, > sum(a.viewcount) as views > return 0(zero) if c.testOnly IS 1 > > > <cfset ctr = ctr+1> > <cfquery name="getSums" datasource="schoolsforums"> > SELECT > '#application.districts.name[ctr]#' as name, > a.id, a.conferenceidfk, > sum(a.msgcount) as msgs, > sum(a.viewcount) as views, > c.testOnly, > b.useridfk, > b.id, > c.id > FROM sf_forums a, sf_threads b, sf_users c > WHERE a.conferenceidfk = '#application.districts.id[ctr]#' and > b.forumidfk = a.id and > c.id = b.useridfk > GROUP BY conferenceidfk > </cfquery> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:302132 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

