-
1. Re: Q of Q Group By
Dan Bracuk Jun 16, 2009 7:56 AM (in response to Dan Bracuk)The workaround is to change this:
<cfquery name="TotalWebSurvey1" dbtype="query">
select answers answers1, col theanswer, qnumber, qtext
from AnswerCount1, questions
where qnum = qnumber
and col <> '[No Answer Entered]'
<!--- add some 0 quanity rows in case a certain answer is not selected by anyone --->
union
select 0 answers1, atext theanswer, qnum qnumber, qtext
from QuestionsAnswers
</cfquery>to this
<cfquery name="TotalWebSurvey1" dbtype="query">
select answers answers1, col theanswer, qnumber, qtext
from AnswerCount1, questions
where qnum = qnumber
and col <> '[No Answer Entered]'
</cfquery><!--- add some 0 quanity rows in case a certain answer is not selected by anyone --->
<cfquery name="TotalWebSurvey2" dbtype="query">
select 0 answers1, atext theanswer, qnum, qtext
from QuestionsAnswers
</cfquery>which will enable this query to run successfully.
<cfquery name="x" dbtype="query">
select qnumber, count(qnumber) cc
from TotalWebSurvey1, TotalWebSurvey2
where qnum = qnumber
group by qnumber
</cfquery>I'm still curious about why my original code crashed.

