Subject Using a query parameter before a sub query
Author Tobias Grimm
Hi!

Using Firebird 2.0 I'm trying to do this query:

SELECT count(*) as y0_ FROM Department this_ WHERE ? < (SELECT count(*)
as y0_ FROM Product this_0_ WHERE this_0_.Department = this_.Number)

But it fails when preparing the query with error code 804.

These queries work just fine:

SELECT count(*) as y0_ FROM Department this_ WHERE 0 < (SELECT count(*)
as y0_ FROM Product this_0_ WHERE this_0_.Department = this_.Number)
SELECT count(*) as y0_ FROM Department this_ WHERE (SELECT count(*) as
y0_ FROM Product this_0_ WHERE this_0_.Department = this_.Number) > 0

Is this a bug in Firebird? I tried it with NHibernate/.NETProvider as
well as Delphi/IBObjects, so this seems not to be a problem of the
client tools.

bye,

Tobias