[Lazarus] SQL question

Ondrej tondrej at gmail.com
Mon Feb 8 14:12:10 CET 2010


On 8 February 2010 12:29, Koenraad Lelong
<lazarus at brouwerij.homelinux.net> wrote:

[snip]
> Are you sure the first query runs on Firebird 2.0 ?

No, AFAIK, Firebird only supports common table expressions since 2.1.
Here's the SQL statement without the CTE:

select
 a.type,
 (
   select
     count(*) count_2008
   from table
   where (type = a.type) and (extract(year from date) = 2008)
 ),
 (
   select
     count(*) count_2009
   from table
   where (type = a.type) and (extract(year from date) = 2009)
 )
from table a;




More information about the Lazarus mailing list