RE: [GENERAL] select and join

From: "Taral" <taral(at)mail(dot)utexas(dot)edu>
To: "ZioBudda" <michel(at)michel(dot)enter(dot)it>, <pgsql-general(at)postgreSQL(dot)org>
Subject: RE: [GENERAL] select and join
Date: 1998-10-23 17:56:16
Message-ID: 000701bdfeae$6ea4ca60$3b291f0a@taral
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> i have make this try:
> esame=> select utente.cognome, prestito.id_utente, libro.tipo,
> count(*) from prestito, libro where libro.id_libro =
> prestito.id_libro and utente.id_utente = prestito.id_utente group
> by id_utente, tipo\g
>
> but the output is :
> ERROR: parser: illegal use of aggregates or non-group column in
> target list

I keep seeing this... When doing something like this, you must have ALL
non-aggregate columns in the GROUP BY.

So: (note you also forgot to update the FROM)

SELECT utente.cognome, prestito.id_utente, libro.tipo, count(*) FROM
prestito, libro, utente WHERE libro.id_libro = prestito.id_libro AND
utente.id_utente = prestito.id_utente GROUP BY cognome, id_utente, tipo;

Taral

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Taral 1998-10-23 17:57:13 RE: [GENERAL] date null
Previous Message ZioBudda 1998-10-23 12:47:04 date null