... - Mailing list pgsql-sql

From Luis Mix
Subject ...
Date
Msg-id 20021010191404.6186.qmail@web13008.mail.yahoo.com
Whole thread Raw
List 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


pgsql-sql by date:

Previous
From: "John Duffy"
Date:
Subject: NOTICE: generated by sequence nextval()
Next
From: "Michael Ansley (UK)"
Date:
Subject: Re: NOTICE: generated by sequence nextval()