|
|
Subject: |
Re: help with a select statement, and count() |
From: |
Steve Turetzky |
Date: |
3/24/1999 4:05:57 PM |
IP: |
192.63.145.149 |
...With the greatest respect to Oracle gurus everywhere, I submit that yours are wrong. Try this:
sqlTest = "SELECT t.name, t.classid, c.timeallowed, c.passpercent, " & _
"c.totalquestions, c.percenthigh, c.active, " & _
"sum(decode(qa.testID ,1 ,1 ,0)) countQuestions1" & _
"sum(decode(qa.testID ,1 ,0 ,1)) countQuestionsNot1" & _
"FROM tests t, class c, question_answer qa, questions q " & _
"WHERE t.testid=c.testid " & _
"AND qa.testid=t.testid " & _
"AND t.testid=" & intTestID & _
"group by t.name, t.classid, c.timeallowed, c.passpercent, " & _
"c.totalquestions , c.percenthigh, c.active"
...If qa.testID can contain zeroes, you'll need to change the DECODE appropriately.
...Hope this helps.
......Steve |
Previous Message
|
|