On Wed, 12 Mar 2008 00:09:40 -0400
Drew Jensen <[EMAIL PROTECTED]> dijo:

> John Jason Jordan wrote:
> > SELECT DISTINCT ( SUBSTR( "QuestionCode", 1, 9 ) ) FROM "MainBank"
> > ORDER BY ( SUBSTR( "QuestionCode", 1, 9 ) )
> >
> > So far so good. Now I need the number of questions in each category,
> > and that is what has me stumped. I tried adding COUNT as follows:
> >
> > SELECT DISTINCT COUNT ( SUBSTR( "QuestionCode", 1, 9 ) ) FROM
> > "MainBank" ORDER BY ( SUBSTR( "QuestionCode", 1, 9 ) )
> >
> > But that just returns the number 7,349. I need the individual count for
> > each category, and I can't figure out the syntax to accomplish this.
> > Any suggestions welcome!

> In other words you want the count for each GROUP of records.
> 
> SELECT Count( * ) FROM "MainBank"
> GROUP BY ( SUBSTR( "QuestionCode", 1, 9 ) )

Thanks, but Base chokes on that:

"Syntax error in SQL expression."

Oddly, it works if I change GROUP BY to ORDER BY:

SELECT Count( * ) FROM "MainBank"
ORDER BY ( SUBSTR( "QuestionCode", 1, 9 ) )

Although then it just gives me one answer, "7,349."

Does Base not understand GROUP BY? Might there be some variant syntax
required? GROUP ON instead of GROUP BY or some such?

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to