On Thu, Jun 18, 2009 at 10:03:21AM -0400, Tom Lane wrote:
> hubert depesz lubaczewski <dep...@depesz.com> writes:
> > # create table sold_products (items int4, product_id int4);
> > # create table products (id int4, codename text);
> > # select sp.count, p.codename from sold_products sp join products p on 
> > sp.product_id = p.id;
> 
> > shown error:
> > ERROR:  column "p.codename" must appear in the GROUP BY clause or be used 
> > in an aggregate function
> > LINE 1: select sp.count, p.codename from sold_products sp join produ...
> >                          ^
> 
> Per the fine manual, sp.count is another way of writing count(sp).
> Does it make more sense now?

I know why it works that way. But it took me while to figure it out, and
the select sp.count from table sp, seems to be rather hacky thing, not
really well known, and of no big use.

Best regards,

depesz

-- 
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: dep...@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to