Re: Undocumented SQL-Feature?
Posted in 1998
On Thu, 25 Jun 1998, Martin Berns wrote:
> try the following statement against stores7:
>
> select count(*) * 100/(select count(*) from cust_calls) percent
> from cust_calls where call_code = 'I';>
> Surprise (at least to me): it works!
> Syntax say select-list may consist of ecpressions only and
> a select-statement isn't an expression.
No, you've found a feature which has been around for a while (several
years) but is not documented in any manual I've seen. It isn't always
clear exactly what you can do with those sub-selects; I don't think they
can be used in the FROM clause (where they'd be most useful!), and it is
not always clear how the variable are scoped -- trying to do correlated
sub-queries can be tricky!
Yours,
Jonathan Leffler (jleffler@informix.com) #include <witticism.h>
Guardian of DBD::Informix -- see http://www.perl.com/CPAN