Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 44123476689 for ; Thu, 10 Oct 2002 15:14:10 -0400 (EDT) Received: from web13008.mail.yahoo.com (web13008.mail.yahoo.com [216.136.174.18]) by postgresql.org (Postfix) with SMTP id 59AD3476400 for ; Thu, 10 Oct 2002 15:14:03 -0400 (EDT) Message-ID: <20021010191404.6186.qmail@web13008.mail.yahoo.com> Received: from [192.100.170.191] by web13008.mail.yahoo.com via HTTP; Thu, 10 Oct 2002 14:14:04 CDT Date: Thu, 10 Oct 2002 14:14:04 -0500 (CDT) From: =?iso-8859-1?q?Luis=20Mix?= To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/137 X-Sequence-Number: 9854 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