Subject Re: [firebird-support] [Qry][Err:-206]Column does not belong to referenced table
Author Andrea Raimondi
Ann W. Harrison wrote:
> I think you don't understand what group by means in SQL. What

I use it very rarely, indeed, thus it's possible.

> you're asking for, I think, is ordering. Do you get what you
> want with this query?
>
> select msgs.*,
> (select avg (rtg.ratingvalue) from messagesratings rtg
> where rtg.message_id = msgs.message_id) as AvgRate
> from Messages msgs
> order by AvgRate

It still cries on AvgRate not being in the referenced table... sigh..

> I greatly prefer to see the actual list of fields from the
> messages table, but ... In any even, if you use aliases, use
> them consistently. Firebird V2 insists on that point.

You can see them in the first message( I posted the DDL ).

> Regards,

Cheers,

> Ann

Andrew