Subject | RE: [firebird-support] subquery field in where phrase |
---|---|
Author | unordained |
Post date | 2008-04-17T14:45:22Z |
>> select a.*, (select count(*) from a1 where a1.b_id = b.id) as F1 from tb a where (select count(*) from a1 where a1.b_id = b.id) = 100; [Alan]
or if you're using FB2, something like:
select z.* from
(select a.*, (select count(*) from a1 where a1.b_id = b.id) as F1 from tb a) z
where z.F1 = 100;
or if you're using FB2.1, you could also try:
with z (select a.*, (select count(*) from a1 where a1.b_id = b.id) as F1 from tb a)
select z.* from z where z.F1 = 100;
As far as I know, there's no performance difference between any of these options? (incl. Alan's?)
- Philip