Subject Re: Nested Select
Author Svein Erling Tysvær
<Just adding to what Ann answered>:

I think this actual select may be rewritten as

SELECT t1.risk, COUNT(distinct
FROM Table1 t1
where not exists(
select * from Table1 t2
where =
and t2.risk > t1.risk)
GROUP BY t1.risk

Though of course there could be other situations that cannot be solved by simply
rewriting the query a little bit.


--- In, "Ann W. Harrison" wrote:
> At 05:59 AM 11/4/2004, jabangarita wrote:
> >How does Firebird/Interbase nested select work in??
> >
> >SELECT t.risk, COUNT(
> >FROM [SELECT, MAX(t1.risk) as risk
> > FROM Table1 AS t1
> > GROUP BY ]. AS t
> >GROUP BY t.risk;
> Firebird 1.5 and earlier don't handle select from select.
> Firebird 2 does, but uses ISO syntax that does not
> include square brackets. For earlier versions, turn
> the inner select into a view or use a stored procedure.
> Regards,
> Ann