Re: duda con clave primaria

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Daneel Tamayo" <daneel_jose07(at)yahoo(dot)com>
Cc: "pgsql-es-ayuda(at)postgresql(dot)org" <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: duda con clave primaria
Date: 2007-12-25 16:48:54
Message-ID: c2d9e70e0712250848u36bd1058ldd11f67009a25a9e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Dec 24, 2007 11:16 PM, Daneel Tamayo <daneel_jose07(at)yahoo(dot)com> wrote:
> gracias a todos por responder
>
> aki envio algunas de las tablas a ver si se ve mejor mi pregunta
>
>
>
> ---con esta tabla es la ke me sucede la repeticion de num_comp
> CREATE TABLE COMPROBANTE_CUENTA
> (NUM_COMP INT,
> Fecha Fecha, FOREIGN KEY (NUM_COMP, Fecha) REFERENCES COMPROBANTE,
> NUM_CUENTA INT REFERENCES CUENTA,tipo char,
> VALOR SALDO,
> id serial, PRIMARY KEY(NUM_CUENTA ,NUM_COMP, Fecha,tipo));
>

una solucion podria ser algo asi:

create unique index comprobante_cuenta_idx1
on comprobante_cuenta (date_part('year', Fecha), date_part('month',
Fecha), num_comp)

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Gabriel Hermes Colina Zambra 2007-12-25 20:13:34 Re: Metodo mas rapido que Join ??? Solo una pregunta.
Previous Message Daneel Tamayo 2007-12-25 04:16:48 [TLM] duda con clave primaria