Re: what's wrong with this query

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: "Thomas T(dot) Thai" <tom(at)minnesota(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: what's wrong with this query
Date: 2001-02-11 08:27:33
Message-ID: Pine.BSO.4.10.10102110326200.10437-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Sun, 11 Feb 2001, Thomas T. Thai wrote:

> still trying to port this app from mysql to pgsql, but getting this error:
>
> Database error: Invalid SQL: select
> t_stories.heading,t_stories.rid,count(*) as cmts from t_stories,t_comments
> where t_comments.toprid = t_stories.rid and t_stories.verified = 'y' group
> by t_comments.toprid order by t_stories.hits desc limit 5
> PostgreSQL Error: 1 (ERROR: Attribute t_stories.heading must be GROUPed or
> used in an aggregate function )
> Session halted.
Precisely this:
---
PostgreSQL Error: 1 (ERROR: Attribute t_stories.heading must be GROUPed
or used in an aggregate function )
---
add t_stories.heading to group by list, and it should work. Mysql
apparently allows such sloppy sql, but postgres won't.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Arun Malhotra - Roll No.99007 2001-02-11 09:21:53 Re: selecting a random record
Previous Message Thomas T. Thai 2001-02-11 07:48:06 what's wrong with this query