Subject | Re: [firebird-support] Re: Group by date on a timestamp field |
---|---|
Author | Martijn Tonies |
Post date | 2005-12-16T09:56:52Z |
> >>Thanks Adam! Works great. Why can't I use something like:because Firebird no longer follows the SQL standard in this case :-)
> >>
> >>select cast(myfieldname as Date) as SomeName, count(*)
> >>from mytablename
> >>group by SomeName
> >
> > Because expressions in SELECT are calculated after expressions in
> > GROUP BY.
>
> Then why does this work ??
> select cast(myfieldname as Date), count(*)
> from mytablename
> group by 1
The SQL standard says that a "group by" can only be done on base
table (or view) columns, not derived columns in the resultset.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com