Subject Re: [firebird-support] Trouble with BETWEEN operator
Author Anderson Farias
Hi,

You could change it to

SELECT r0.UID FROM TAB_A r0
WHERE EXISTS (SELECT 1 FROM TAB_B WHERE
r0.UID = AID having COUNT(1) BETWEEN 1 AND 10)

or

SELECT r0.UID FROM TAB_A r0
WHERE (SELECT 1 FROM TAB_B WHERE
r0.UID = AID having COUNT(1) BETWEEN 1 AND 10) is not null;

or something like that

Regards,
Anderson Farias

----- Original Message -----
From: "ainpoissee" <ainpoissee@...>
To: <firebird-support@yahoogroups.com>
Sent: Thursday, April 10, 2008 10:17 AM
Subject: [firebird-support] Trouble with BETWEEN operator


Hi,

When executing query

SELECT r0.UID FROM TAB_A r0 WHERE ((SELECT COUNT(1) FROM TAB_B WHERE
r0.UID = AID) BETWEEN 1 AND 10)

I get following error:

Unsupported field type specified in BETWEEN predicate.
Unsuccessful execution caused by an unavailable resource.
Error Code: 493

in isql same query causes error:

Statement failed, SQLCODE = -904
Unsupported field type specified in BETWEEN predicate.

The same query with NOT BETWEEN runs just fine. Any idea whats wrong
(ie is the SQL invalid or is it a bug in FB)? Tested with 2.0 and 2.1

BTW is there some documentation about how the [NOT] BETWEEN works in
FB in the sense that are the "test values" included or excluded etc?


TIA
ain