From: Luis Mix <ksql2002(at)yahoo(dot)com(dot)mx>
To: pgsql-sql(at)postgresql(dot)org
Subject:
Date: 2002-10-10 19:14:04
Message-ID: 20021010191404.6186.qmail@web13008.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a period of consultation with Fecha1 and Fecha2
and two tables with the follow data:

Table1
----
|Clave_activo | Cantidad | fecha |
| | | |
| clave1 | 5 | 01/02/00 |
| clave3 | 7 | 05/05/01 |
| clave1 | 2 | 03/09/02 |
| clave2 | 2 | 27/01/01 |
| clave1 | 1 | 03/11/02 |
| clave3 | 1 | 25/08/01 |
| clave2 | 3 | 27/01/00 |
| clave1 | 8 | 03/12/01 |
| clave2 | 2 | 27/01/02 |
| clave1 | 1 | 03/12/00 |
| clave3 | 2 | 25/08/02 |
| .. | .. | .. |

Y Table2
----
|Clave_activo | nombre |
| | |
| clave1 | Product1 |
| clave3 | Product3 |
| clave3 | Product3 |
| clave2 | Product2 |
| clave1 | Product1 |
| .. | .. |

I need the SQL Instruction to obtain something like
that:

(Sum Product by year)
| Nombre |yearFecha1|00|01|02|YearFecha2 |Total|
| Product1 | .. | 6| 8| 3| ... | 17 |
| Product2 | .. | 3| 2| 2| ... | 07 |
| Product3 | .. | 7| 1| 2| ... | 10 |

For my it is very important their help then has one
week to finish my reports and east already has me a
mess...

If somebody wanted to help me with the other
consultations, please tell me for private, be not that
it bothers, my consultations to the other partners...

_________________________________________________________
Do You Yahoo!?
La emoción e intensidad del deporte en Yahoo! Deportes. http://deportes.yahoo.com.mx

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-10-10 23:03:31 Missing Review
Previous Message Roberto Mello 2002-10-10 15:19:59 Re: SELECT with INNER data bases