Re: REPOST: Trouble with SQL conversion

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Richard Ellerbrock <richarde(at)eskom(dot)co(dot)za>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: REPOST: Trouble with SQL conversion
Date: 2002-04-11 13:28:32
Message-ID: 20020411212639.C68173-100000@houston.familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Rajesh Kumar Mallah 2002-04-11 14:04:28 using output of a subselect in LIKE/ILIKE
Previous Message Samuel J. Sutjiono 2002-04-11 13:14:02 Transactional vs. Read-only (Retrieval) database