Reputation: 1547
I am trying to run the following query but it is not working!
select extract(month from flight_date_time) mnt from T_PEREXOD where extract( year from flight_date_time)='2012'
group by mnt
order by mnt
I tried also subquerying
select mnt from (select extract(month from flight_date_time) AS mnt from T_PEREXOD)
group by mnt
order by mnt
but it pops out an error Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 1, char 18.
select.
Is that a problem of Firebird version 1 ??
How about making groupping work without any views, procedures, computed fields and so on ? 'cause I don't like to alter that database !
Upvotes: 1
Views: 1278
Reputation: 2373
First - Extract returns a smallint or decimal value so your where clousure is wrong.
Second - Subqueries are supported from 1.5 up
Try changing SELECT EXTRACT(...) as mnt
(add as) in your first query or try to use column index grouping like
GROUP BY 1
ORDER BY 1
Firebird 1.0 sql conformance is something you might be interesting in but this is the only one I can find: http://www.firebirdsql.org/en/sql-conformance/
If you have any opportunity I advise updating to latest release of FB
Upvotes: 3