RE: [GENERAL] select and join
Taral <taral@mail.utexas.edu>
From: "Taral" <taral@mail.utexas.edu>
To: "ZioBudda" <michel@michel.enter.it>, <pgsql-general@postgreSQL.org>
Date: 1998-10-23T17:56:16Z
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