X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id EF6159DCAD7 for ; Thu, 8 Dec 2005 07:25:49 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68189-07 for ; Thu, 8 Dec 2005 07:25:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtp200.mail.sc5.yahoo.com (smtp200.mail.sc5.yahoo.com [216.136.130.125]) by postgresql.org (Postfix) with SMTP id D90749DCAE0 for ; Thu, 8 Dec 2005 07:25:45 -0400 (AST) Received: (qmail 91461 invoked from network); 8 Dec 2005 11:25:33 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.br; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=xZ/Ce7QK2RP8MUUhvnw6t4kNTMx17hpJyqapdF0+OwzMSvZmjV/Gaw02ySFu9JRNZveGB7jIJZqs2WQwJiA6BenEeh0PqW0EsxvlalLjIpWSlB1WoxFjPwZOTX++5GDOPrxq/xzw/FSygzRR+0ZN+QJxGFpU2mFSv1OJMwZ+glU= ; Received: from unknown (HELO ?201.32.131.140?) (clark?vr@201.32.131.140 with plain) by smtp200.mail.sc5.yahoo.com with SMTP; 8 Dec 2005 11:25:30 -0000 Message-ID: <439817E1.2070708@yahoo.com.br> Date: Thu, 08 Dec 2005 09:24:17 -0200 From: =?ISO-8859-1?Q?Alexandre_Gon=E7alves_Jacarand=E1?= User-Agent: Mozilla Thunderbird 1.0.6-7.1.20060mdk (X11/20050322) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: Andrew Sullivan CC: pgsql , osvaldo_kussama@yahoo.com.br, aaronkoning@gmail.com Subject: Re: Help on function creating References: <4396D50D.5060407@yahoo.com.br> <20051207162158.GC1315@phlogiston.dyndns.org> In-Reply-To: <20051207162158.GC1315@phlogiston.dyndns.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200512/72 X-Sequence-Number: 23614 Thanks Andrew, Osvaldo ( Obrigado) and Aaron !! Sory Andrew the right version number is 7.4.3 and I'll study the crosstab because it's seems to fit for sutuation. See you... Andrew Sullivan escreveu: > I think you can do this with the contrib/crosstab stuff. But AFAIK, > there's no such thing as Pg 7.5.3. > > A > > On Wed, Dec 07, 2005 at 10:26:53AM -0200, Alexandre Gonçalves Jacarandá wrote: > >>Hello everyone, I'm using postgresql form an year and I have some >>difficult to write a function to make an report. I'm running PostgreSQL >>7.5.3 on i686-pc-linux-gnu (Mandriva 10.1). My table structure is: >>Tabela "public.matricula" >> Column | Type | Modifiers >> >>-------------------------+--------------------------+------------------------------------------------- >> id | integer | not null default >>nextval('seq_matricula'::text) >> ref_contrato | integer | >> ref_pessoa | integer | >> ref_campus | integer | >> ref_curso | integer | >> ref_periodo | character varying(10) | >> ref_disciplina | integer | >> ref_curso_subst | integer | >> ref_disciplina_subst | integer | >> ref_disciplina_ofer | integer | >> nota | double precision | default 0 >> nota_exame | double precision | default 0 >> nota_final | double precision | default 0 >> conceito | character varying(5) | default >>''::character varying >> conceito_exame | character varying(5) | default >>''::character varying >> conceito_final | character varying(5) | default >>''::character varying >> >>I need to have an output like: >>ref_pessoa | ref_disciplina1 | ref_disciplina2 | ... | ref_disciplina n >>1 | nota_final1 | nota_final2 | ... | nota_final n >> >>How can I make this ? I know that I need to declare an variable an than >>make an for - loop, but I don't know how. Where can I get some examples >>for this? >>Thanks. >> >>-- >>__________________________ >>Alguns caminham pelo arco, >>eu caminho pela reta. >> >>Alexandre Gonçalves Jacarandá >>Assessor de Tecnologia de Informação >>Tel.: 0 ** 21 8131-2313 >> >> >> >> >> >> >> >>_______________________________________________________ >>Yahoo! doce lar. Faça do Yahoo! sua homepage. >>http://br.yahoo.com/homepageset.html >> >> >>---------------------------(end of broadcast)--------------------------- >>TIP 3: Have you checked our extensive FAQ? >> >> http://www.postgresql.org/docs/faq > > -- __________________________ Alguns caminham pelo arco, eu caminho pela reta. Alexandre Gonçalves Jacarandá Assessor de Tecnologia de Informação Tel.: 0 ** 21 8131-2313 _______________________________________________________ Yahoo! doce lar. Faça do Yahoo! sua homepage. http://br.yahoo.com/homepageset.html