[SQL]

2002-10-10 Thread Luis Mix



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

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[SQL] How can I quit this: "Unique " to my table?

2003-04-01 Thread Luis Mix
Hello pgsql-sql,

  When my table was create I wrote this:

  MyDatabase=# create table b_prestamo(no_inventa char(16) unique not
  null, cve_area char(10), date1 date);
  I need now that my table can accept repeated records, but not Null.
  How can I do that?
  SomeBody can help me please?
  My table has information at the moment,what can I do for maintain
  it?
  
  

-- 
Best regards,
 Luis  mailto:[EMAIL PROTECTED]


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly