Subject Re: [firebird-support] Similar SQL query fails
Author Arno Brinkman
Hi,

> The first query uses the same table in both the select and the
> sub-select.
> The second working query uses the same view in both the select and the
> sub-select.
>
> How is this different?

In the first query you reference to the "master" relation and in the second query to the
sub-relation.

<snip>
FROM
MDDB_DRUG d
WHERE

<snip>
select MIN( d.AWP / d.QTY )
from MDDB_DRUG d2

Inside the MIN you reference to table wit alias d instead of table with alias d2

Regards,
Arno Brinkman
ABVisie

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
General database development support:
http://www.databasedevelopmentforum.com

Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/

Support list for Firebird and Interbase users :
firebird-support@yahoogroups.com

Nederlandse firebird nieuwsgroep :
news://newsgroups.firebirdsql.info