| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Josué Maldonado <josue(at)lamundial(dot)hn> |
| Cc: | pgsql general list <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Data format and display |
| Date: | 2005-01-22 19:58:12 |
| Message-ID: | 24819.1106423892@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
=?ISO-8859-1?Q?Josu=E9_Maldonado?= <josue(at)lamundial(dot)hn> writes:
> I have a table that contains this raw data:
> epr_procode | epr_tipo | epr_mes | epr_valor | zert_title
> -------------+----------+---------+-----------+----------------------
> 00C188 | VTA | 200309 | 2116.0000 | Venta
> 00C188 | CTO | 200309 | 1600.0700 | Costo
> 00C188 | VTA | 200311 | 3450.0000 | Venta
> 00C188 | CTO | 200311 | 2687.4200 | Costo
> I need to display it this way:
> TITULO |200309 |200310 |200311 |200312
> -------------+----------+---------+-----------+----------------------
> Venta |2116.0000 |0.0000 |3450.0000 |0.0000
> Costo |1600.0700 |0.0000 |2687.4200 |0.0000
I think the "crosstab" functions in contrib/tablefunc/ might help you.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ed L. | 2005-01-22 21:03:58 | pg SQL question |
| Previous Message | Chris | 2005-01-22 19:25:39 | SCHEMA compatibility with Oracle/DB2/Firebird |