Re: [SQL] help with pagila

2006-09-04 Thread Markus Schaber
Hi, Tom, Tom Lane wrote: > If film_id is a primary key for film, then it's actually legal per SQL99 > (though not in earlier SQL specs) to just GROUP BY film_id and then > reference the other columns of film without explicit grouping, because > clearly there can be only one value of them per film

Re: [SQL] help with pagila

2006-09-01 Thread Stephan Szabo
On Fri, 1 Sep 2006, Walter Cruz wrote: > Hi all. I'm with a little doubt. > > I'm testing the pagila (the postgres port of mysql sakila sample). > > Well, I was trying to translate the query: > > select > film.film_id AS FID, > film.title AS title, > film.description AS description

Re: [SQL] help with pagila

2006-09-01 Thread Walter Cruz
Thank you all.I found myself with the same trouble in last week, when I tried to port mambo CMS to PostgreSQL.After some work, In fall i a query like the one that was quoted by Andrew and decided to stop. In that time, my guess wae that something was wrong with MySQL.(I don't know.. I have seen que

Re: [SQL] help with pagila

2006-09-01 Thread Tomas Vondra
> So I can assume that the MySQL implementation is strange? (It accepts > that kind of query) Yes, MySQL behaves strangely in this case (as well as in several other cases). I wouldn't rely on this as it probably can choose different values each time (although as far as I remember I haven't seen th

Re: [SQL] help with pagila

2006-09-01 Thread Tom Lane
Andrew Sullivan <[EMAIL PROTECTED]> writes: > On Fri, Sep 01, 2006 at 02:26:39PM -0300, Walter Cruz wrote: >> So I can assume that the MySQL implementation is strange? (It accepts that >> kind of query) > In my experience, it is almost never safe to assume that the MySQL > approach to SQL bears an

Re: [SQL] help with pagila

2006-09-01 Thread Scott Marlowe
On Fri, 2006-09-01 at 12:26, Walter Cruz wrote: > So I can assume that the MySQL implementation is strange? (It accepts > that kind of query) Yes, according to the SQL spec, you should generally get an error when you run a query like this: select field1, field2 from table group by field1 since y

Re: [SQL] help with pagila

2006-09-01 Thread Tomas Vondra
> But, when I add another column on select, like, film_description, I get > the following error: > > "ERROR: column "film.description" must appear in the GROUP BY clause or > be used in an aggregate function" > > If I put that column on GROUP BY everything works ok. But I want > understant why d

Re: [SQL] help with pagila

2006-09-01 Thread Andrew Sullivan
On Fri, Sep 01, 2006 at 02:26:39PM -0300, Walter Cruz wrote: > So I can assume that the MySQL implementation is strange? (It accepts that > kind of query) In my experience, it is almost never safe to assume that the MySQL approach to SQL bears anything but a passing resemblance to SQL proper. Thi

Re: [SQL] help with pagila

2006-09-01 Thread Walter Cruz
So I can assume that the MySQL implementation is strange? (It accepts that kind of query)[]'s- WalterOn 9/1/06, Andrew Sullivan < [EMAIL PROTECTED]> wrote:On Fri, Sep 01, 2006 at 10:31:48AM -0300, Walter Cruz wrote: > "ERROR:  column "film.description" must appear in the GROUP BY clause or be> used

Re: [SQL] help with pagila

2006-09-01 Thread Andrew Sullivan
On Fri, Sep 01, 2006 at 10:31:48AM -0300, Walter Cruz wrote: > "ERROR: column "film.description" must appear in the GROUP BY clause or be > used in an aggregate function" > > If I put that column on GROUP BY everything works ok. But I want understant > why do I need to do that. Can someone teach

[SQL] help with pagila

2006-09-01 Thread Walter Cruz
Hi all. I'm with a little doubt.I'm testing the pagila (the postgres port of mysql sakila sample).Well, I was trying to translate the query:select film.film_id AS FID, film.title AS title, film.description AS description, category.name AS category, film.rental_rate AS price,