pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Rick Schumeyer <rschumeyer@ieee.org>
Cc: pgsql-sql@postgresql.org
Subject: Re: pg, mysql comparison with "group by" clause
Date: Tue, 11 Oct 2005 14:32:45 -0700 (PDT)
Message-ID: <20051011142658.C54076@megazone.bigpanda.com> (raw)
In-Reply-To: <001001c5cea8$77cabc90$0300a8c0@dell8200>
References: <001001c5cea8$77cabc90$0300a8c0@dell8200>

On Tue, 11 Oct 2005, Rick Schumeyer wrote:

> I'm not sure what I was thinking, but I tried the following query in pg:
>
> SELECT * FROM t GROUP BY state;
>
> pg returns an error.
>
> Mysql, OTOH, returns the first row for each state.  (The first row with
> "AK", the first row with "PA", etc.)
>
> I'm no SQL expert, but it seems to me that the pg behavior is correct, and
> the mysql result is just weird.  Am I correct?

In your case, it sounds like the mysql result is wrong. I believe SQL99
would allow it if the other columns were functionally dependant upon state
(as there'd by definition only be one value for the other columns per
group).




view thread (28+ messages)  latest in thread

Message-ID: <20051011142658.C54076@megazone.bigpanda.com>
Permalink:  ../20051011142658.C54076@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20051011142658.C54076@megazone.bigpanda.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sszabo@megazone.bigpanda.com, rschumeyer@ieee.org
  Subject: Re: pg, mysql comparison with "group by" clause
  In-Reply-To: <20051011142658.C54076@megazone.bigpanda.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox