Try it like so. <cfquery name="getData" datasource="#ARGUMENTS.DSN#"> SELECT ,PL.question ,PR.questionAnswer, (select count(*) from pollResults pr) as results FROM polls as PL LEFT OUTER JOIN pollResults as PR ON PL.pollID = PR.pollID AND PR.active = '1' WHERE PL.active = '#ARGUMENTS.active#' </cfquery>
Doug B. ----- Original Message ----- From: "Richard Cooper" <[EMAIL PROTECTED]> To: "CF-Talk" <[email protected]> Sent: Friday, January 19, 2007 4:51 AM Subject: tallying SQL row entries > Hi all, > > I have an online poll which allows users to add the answers to the database. > > I can get the results like this: > <cfquery name="getData" datasource="#ARGUMENTS.DSN#"> > SELECT ,PL.question > ,PR.questionAnswer > FROM polls as PL > LEFT OUTER JOIN > pollResults as PR > ON PL.pollID = PR.pollID > AND PR.active = '1' > WHERE PL.active = '#ARGUMENTS.active#' > </cfquery> > > Ideally I'd like to be able to count the answers within the SQL, but I'm getting stuck because the questionAnswer varies from question to question. Is there a way to tally this up? > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266975 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

