help with pagila - Mailing list pgsql-sql

From Walter Cruz
Subject help with pagila
Date
Msg-id 32cabba0609010631t233d13f9o38edba0483a2446c@mail.gmail.com
Whole thread Raw
Responses Re: help with pagila
Re: help with pagila
Re: help with pagila
List pgsql-sql
Hi all. I'm with a little doubt.<br /><br />I'm testing the pagila (the postgres port of mysql sakila sample).<br /><br
/>Well,I was trying to translate the query:<br /><br /><pre><code>select<br />     film.film_id AS FID,<br />
film.titleAStitle,<br />     film.description AS description,<br />     <a
href="http://category.name">category.name</a>AS category,<br />     film.rental_rate AS price,<br />     film.length AS
length,<br/>     film.rating AS rating,<br />    group_concat(concat(actor.first_name,_utf8' ',actor.last_name)
separator',') AS actors <br />from<br />     category<br />     inner join film on(category.category_id =
film.category_id)<br/>     inner join film_actor on(film.film_id= film_actor.film_id)<br />     inner join actor
on(film_actor.actor_id= actor.actor_id)<br />group by<br />    film.film_id;</code></pre><br />That cant be find here:
<ahref="http://www.stardata.it/articoli_en/mysql_sample_db_articoli_en.html">
http://www.stardata.it/articoli_en/mysql_sample_db_articoli_en.html</a><br/><br />I read a comment by David Fetter on a
blogabout group concat. I'm following his example:<br /><br />select<br />     film.title AS title,  <br />    
array_to_string(array_accum(actor.first_name || ' ' || actor.last_name),',') AS actors <br />from<br />     film<br
/>    inner join film_actor on film.film_id = film_actor.film_id<br />     inner join actor on film_actor.actor_id =
actor.actor_id<br />    GROUP BY film.title<br />     <br /><br /><br />But, when I add another column on select, like,
film_description,I get the following error:<br /><br />"ERROR:  column "film.description" must appear in the GROUP BY
clauseor be used in an aggregate function" <br /><br />If I put that column on GROUP BY everything works ok. But I want
understantwhy do I need to do that. Can someone teach me, please?<br /><br />[]'s<br />- Walter<br /> 

pgsql-sql by date:

Previous
From: "Aaron Bono"
Date:
Subject: Re: Trigger with Stored Procedure [Client Points]
Next
From: Andrew Sullivan
Date:
Subject: Re: help with pagila