Build an statement

From: Alexander Burbello <burbello3000(at)yahoo(dot)com(dot)br>
To: Lista Postgres <pgsql-admin(at)postgresql(dot)org>
Subject: Build an statement
Date: 2006-10-10 17:37:15
Message-ID: 452BDA4B.5030706@yahoo.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Browse pgsql-admin by date

  From Date Subject
Next Message Richard Ray 2006-10-10 19:22:53 How to remove a superuser
Previous Message Jim C. Nasby 2006-10-10 15:37:25 Re: Copying data from table to table (cloned tables)