Subject | Re: Trouble with BETWEEN operator |
---|---|
Author | ainpoissee |
Post date | 2008-04-11T13:30:18Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@...> wrote:
illustrates one such misunderstanding:
and would not ever reach the point of returning either true or false
if there were more than 10 matches. The engine *should* return an
"expression evaluation not supported" on this predicate.
Hmm, I did a quick test with this one and it seems to work just fine -
ie it won't return the records which do have more than 10 related
records in TAB_B. Using FB 2.0.3
BTW why is COUNT(1) not legal? I thought thats the most efficient way
to get count as there is no need to look up specific field(s), just
number of matching rows...
ain
>grouping and aggregation. The example shown by Anderson Farias
> My concern is that people will come to grief if they misapply
illustrates one such misunderstanding:
>would always terminate and return true if at least one match were made
> 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)
>
> which is not valid, i.e., if COUNT(1) were legal (and it's not) it
and would not ever reach the point of returning either true or false
if there were more than 10 matches. The engine *should* return an
"expression evaluation not supported" on this predicate.
Hmm, I did a quick test with this one and it seems to work just fine -
ie it won't return the records which do have more than 10 related
records in TAB_B. Using FB 2.0.3
BTW why is COUNT(1) not legal? I thought thats the most efficient way
to get count as there is no need to look up specific field(s), just
number of matching rows...
ain