A huge headache later it's all sorted. Here's the finalised code (I haven't 
removed extra columns)

<!--- get the info from the database --->
<cfquery name="getData" datasource="#ARGUMENTS.DSN#" 
maxrows="#ARGUMENTS.maxrows#">
SELECT  PL.pollGroupID
                ,PL.questionType
                ,PL.questionText
                ,PL.question
                ,PL.displayResult
                ,PL.priority
                ,PR.questionAnswer
                ,count(questionAnswer) as NumbAnswers
FROM    polls as PL
INNER JOIN      
                pollresults as PR
ON              PL.pollgroupID = PR.pollgroupID
WHERE   PL.active = '#ARGUMENTS.active#'
<cfif isDefined("ARGUMENTS.pollID")>
AND             PL.pollGroupID = (SELECT        pollGroupID     FROM    Polls   
WHERE   pollID = <cfqueryparam value="#ARGUMENTS.pollID#" 
cfsqltype="cf_sql_integer" />)
</cfif>
AND             PL.lingo = '#ARGUMENTS.lingo#'
<cfif isDefined("ARGUMENTS.eventID")>
AND             PL.eventID = '#ARGUMENTS.eventID#'
</cfif>
AND             PR.active = '1'
GROUP BY        PL.pollGroupID
                ,PL.questionType
                ,PL.questionText
                ,PL.question
                ,PL.displayResult
                ,PL.priority
                ,PR.questionAnswer
ORDER BY
                PL.priority
</cfquery>

I had a fluke problem with some deceptive looking data which may have mean't I 
thought that it was incorrectly working at points, so one of the above options 
may have been right. Should have finished a couple of hours ago so enjoy your 
weekends and thanks again for your help. 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:267009
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to