Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 853B29FA27F for ; Tue, 10 Oct 2006 14:37:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 92580-08 for ; Tue, 10 Oct 2006 17:37:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.cresoltec.com.br (unknown [200.103.143.8]) by postgresql.org (Postfix) with SMTP id 245959FB2EF for ; Tue, 10 Oct 2006 14:37:24 -0300 (ADT) Received: (qmail 22614 invoked from network); 10 Oct 2006 17:37:39 -0000 Received: from unknown (HELO ?10.90.2.162?) (10.90.2.162) by mail.cresoltec.com.br with SMTP; 10 Oct 2006 17:37:39 -0000 Message-ID: <452BDA4B.5030706@yahoo.com.br> Date: Tue, 10 Oct 2006 14:37:15 -0300 From: Alexander Burbello User-Agent: Mozilla Thunderbird 1.0.2 (X11/20060423) X-Accept-Language: pt-br, pt MIME-Version: 1.0 To: Lista Postgres Subject: Build an statement Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.335 tagged_above=0 required=5 tests=DNS_FROM_RFC_ABUSE, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200610/68 X-Sequence-Number: 23371 Hi people, I am begginer on Postgres, and I would like to build a report this way: 1 - Central 101 - Base Rio 1001 - Sing X 1002 - Sing Y 1003 - Sing Z 102 - Base Sao Paulo 1004 - Sing A 1004 - Sing A 1004 - Sing A In my table, I have the following data: coo_cod_cooperative coo_cooperative_up coo_type coo_name ---------------------- --------------------------- ----------- -------------------- 1001 100 3 Singular X 1002 100 3 Singular Y 1003 100 3 Singular Z 100 1 2 Base Sao Paulo 101 1 2 Base Rio de Janeiro 1004 101 3 Singular A 1005 101 3 Singular B 1006 101 3 Singular C 1 (null) 1 Central COO_TYPE means: 1 master; 2 - regional; 3 - offices I would like to do this statement independent the code, based on type. Is it possible to do on Postgres? Thanks in advance. Alexander