Gregory Stark escribió:
> I get this about once a day because I frequently type this ad-hoc query and
> always forget to put the alias in the first time:
>
> postgres=# select count(*),n from (select count(*) as n from test group by i) group by n;
> ERROR: subquery in FROM must have an alias
> HINT: For example, FROM (SELECT ...) [AS] foo.
Exactly one extra keystroke gets you a non-error answer:
alvherre=# select count(*),n from (select count(*) as n from test group by i)a group by n;
--
Alvaro Herrera http://www.PlanetPostgreSQL.org/
"Si quieres ser creativo, aprende el arte de perder el tiempo"