Subject Re: [firebird-support] Simple SQL question
Author Martijn Tonies
> I would have done it like this:
>
> Select t1.Field1, t1.Field2, SUM(t1.Field3),
> (select count(*) from table1 t2) as totalcount
> from t1.Table1
> Group by 1,2

But it would different results, wouldn't it?

Martijn Tonies
Database Workbench - development tool for Firebird and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

> I haven't tested but the following should work.
> SELECT COUNT(*) FROM (
> Select
> Field1,
> Field2,
> SUM(Field3)
> from Table1
> Group by 1,2
> )