Subject | Re: subquery field in where phrase |
---|---|
Author | tailuo2002 |
Post date | 2008-04-17T14:37:42Z |
--- In firebird-support@yahoogroups.com, "Alan McDonald" <alan@...>
wrote:
But it is strange. My original sql can be excuted while using sqlite
but not firebird.
wrote:
>Thank you, I will try your method.
> > This is my sql:
> >
> > select a.*,
> > (select count(*) from a1 where a1.b_id = b.id) as F1
> > from tb a
> > where F1 = 100
> >
> > but it can't be executed. The error messsage is:
> >
> > Column does not belong to referenced table.
> > Dynamic SQL Error.
> > SQL error code = -206.
> > Column unknown.
> > F1
> >
> > Thank you.
>
> Use this instead
>
> > 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
>
But it is strange. My original sql can be excuted while using sqlite
but not firebird.