Received: from mail-spool3.eskom.co.za (mail-spool3.eskom.co.za [147.110.49.17]) by postgresql.org (Postfix) with ESMTP id 752D1477268 for ; Thu, 11 Apr 2002 11:17:05 -0400 (EDT) Received: from eskom.co.za (gw.eskom.co.za [147.110.52.108]) by mail-spool3.eskom.co.za (8.11.5/8.11.5) with ESMTP id g3BHH3820025 for ; Thu, 11 Apr 2002 17:17:03 GMT Received: from ROUTING-MTA by eskom.co.za with Novell_GroupWise; Thu, 11 Apr 2002 17:17:07 +0200 Message-Id: X-Mailer: Novell GroupWise Internet Agent 6.0.1 Date: Thu, 11 Apr 2002 17:16:50 +0200 From: "Richard Ellerbrock" To: Cc: Subject: Re: REPOST: Trouble with SQL conversion Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Archive-Number: 200204/140 X-Sequence-Number: 7405 I am an idiot! Actually your suggestion does work - it would help to do it against a customer that actually has records! >>> Christopher Kings-Lynne 2002/04/11 03:28:32 >>> > SELECT base.baseindex, base.subnetsize, base.descrip, base.baseaddr, > base.admingrp, count(ipaddr.baseindex) AS cnt FROM base > LEFT JOIN ipaddr ON base.baseindex=ipaddr.baseindex WHERE > base.baseaddr > BETWEEN 2473473024 AND 2473473151 AND base.customer=1 > GROUP BY base.baseindex > ORDER BY base.baseaddr; > 0: ERROR: Attribute base.subnetsize must be GROUPed or used in an > aggregate function Do what it says. Add base.subnetsize to the GROUP BY. You'll probably need to add base.descrip, base.baseaddr and base.admingrp as well. Chris