Received: from eba-haus.de ([149.228.241.175]) by hub.org (8.10.1/8.10.1) with SMTP id e65CBfS06824 for ; Wed, 5 Jul 2000 08:11:42 -0400 (EDT) Received: from kopo001 by eba-haus.de;Wed, 05 Jul 2000 12:11:25 GMT with Novell_GroupWise; Wed, 05 Jul 2000 14:11:26 +0200 Message-Id: X-Mailer: Novell GroupWise 5.5.2 Date: Wed, 05 Jul 2000 14:11:22 +0200 From: "Gerhard Dieringer" To: " Cc: Subject: Antw: GROUP by Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id e65CBhS06839 X-Archive-Number: 200007/32 Antti Linno wrote: > I have table job, and I want to select data from it, grouping by > workgroups. When I use > select id,name from job where workgroup='top leaders' AND ... group by > workgroup; > When I want to group, I get > ERROR: Illegal use of aggregates or non-group column in target list > I'm confused, why does query work only with sum,min etc. alone in > select. > > Antti You can use GROUP BY only in conjunction with aggregat functions. Then you have to gruop by all attributes in the target list, that are not aggregated. Example: select id,name, workgroup, count(*) from job where workgroup='top leaders' AND ... group by id,name,workgroup; ------------- Gerhard