Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 8793C2E002F for ; Mon, 16 Jun 2008 16:43:35 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 25536-10 for ; Mon, 16 Jun 2008 16:43:28 -0300 (ADT) X-Greylist: delayed 00:06:38.85543 by SQLgrey-1.7.6 Received: from smtpauth22.prod.mesa1.secureserver.net (smtpauth22.prod.mesa1.secureserver.net [64.202.165.44]) by developer.postgresql.org (Postfix) with SMTP id 296B82E002C for ; Mon, 16 Jun 2008 16:43:29 -0300 (ADT) Received: (qmail 19107 invoked from network); 16 Jun 2008 19:36:48 -0000 Received: from unknown (190.10.61.54) by smtpauth22.prod.mesa1.secureserver.net (64.202.165.44) with ESMTP; 16 Jun 2008 19:36:46 -0000 Message-ID: <9B6AE1F27D0B459AA36DEC47A1A05AFE@PC1> From: "Oscar Uribe" To: Subject: Sequences Date: Sat, 3 May 2008 13:35:41 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0003_01C8AD22.94C39C80" X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 12.0.1606 X-MimeOLE: Produced By Microsoft MimeOLE V12.0.1606 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.811 tagged_above=0 required=5 tests=DATE_IN_PAST_96_XX=2.32, HTML_MESSAGE=0.001, UPPERCASE_50_75=0.49 X-Spam-Level: ** X-Archive-Number: 200806/492 X-Sequence-Number: 134021 Éste es un mensaje de varias partes en formato MIME. ------=_NextPart_000_0003_01C8AD22.94C39C80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi,=20 I need to do something with a sequence. This is the example: CREATE TABLE TABLE1( PRIMARY1 INTEGER NOT NULL, OTHER1 VARCHAR (20) NOT NULL, CONSTRAINT "MYPK1" PRIMARY KEY (PRIMARY1) ); CREATE SEQUENCE "SEQ_1" INCREMENT BY 1 MINVALUE 1 NO MAXVALUE START WITH = 1 CACHE 1 NO CYCLE OWNED BY TABLE1.PRIMARY1; CREATE TABLE TABLE2( PRIMARY1 INTEGER NOT NULL, REF1 INTEGER NOT NULL, OTHER1 INTEGER NOT NULL, OTHER2 VARCHAR(20), CONSTRAINT "MYPK2" PRIMARY KEY (PRIMARY1), CONSTRAINT "MYREF1" FOREIGN KEY (REF1) REFERENCES TABLE1(PRIMARY1), CONSTRAINT "MYUK1" UNIQUE (REF1,OTHER1) ); CREATE SEQUENCE "SEQ_1" INCREMENT BY 1 MINVALUE 1 NO MAXVALUE START WITH = 1 CACHE 1 NO CYCLE OWNED BY TABLE2.PRIMARY1; TABLE1 PRIMARY1 OTHER1 1 A 2 B 3 C With this two tables I wan to create a sequence that do: TABLE2 PRIMARY1 REF OTHER1 OTHER2 1 1 1 A 2 1 2 B 3 1 3 C 4 2 1 A 5 2 2 B 6 3 1 A 7 3 2 B 8 3 3 C 9 3 4 D 10 1 4 D 11 1 5 E 12 3 5 E 13 2 3 E I want to create a sequence that increases in unit column 3 for each = record individually in column 2 How do i create a sequence that can manage this? Is there a solution for this? Thanks Oscar Uribe ------=_NextPart_000_0003_01C8AD22.94C39C80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
I need to do something with a sequence. = This is the=20 example:
 
CREATE TABLE TABLE1(
 
    PRIMARY1 = INTEGER NOT=20 NULL,
    OTHER1 VARCHAR = (20) NOT=20 NULL,
    CONSTRAINT = "MYPK1" PRIMARY=20 KEY (PRIMARY1)
 
);
 
CREATE SEQUENCE "SEQ_1" INCREMENT BY 1 = MINVALUE 1=20 NO MAXVALUE START WITH 1 CACHE 1 NO CYCLE OWNED BY = TABLE1.PRIMARY1;
 
CREATE TABLE TABLE2(
 
    PRIMARY1 = INTEGER NOT=20 NULL,
    REF1 INTEGER = NOT=20 NULL,
    OTHER1 INTEGER = NOT=20 NULL,
    OTHER2=20 VARCHAR(20),
    CONSTRAINT = "MYPK2" PRIMARY=20 KEY (PRIMARY1),
    CONSTRAINT = "MYREF1" FOREIGN=20 KEY (REF1) REFERENCES TABLE1(PRIMARY1),
    CONSTRAINT = "MYUK1" UNIQUE=20 (REF1,OTHER1)
 
);
 
CREATE SEQUENCE "SEQ_1" INCREMENT BY 1 = MINVALUE 1=20 NO MAXVALUE START WITH 1 CACHE 1 NO CYCLE OWNED BY=20 TABLE2.PRIMARY1;
 
 
 
TABLE1
 
PRIMARY1        OTHER1
1          &nb= sp;           &nbs= p; A
2          &nb= sp;           &nbs= p; B
3          &nb= sp;           &nbs= p; C
 
 
With this two tables I wan to create a = sequence=20 that do:
 
 
TABLE2
 
PRIMARY1        REF = ;           OTHER1       &nb= sp;    OTHER2
1          &nb= sp;           &nbs= p; 1          &nbs= p;     1         &n= bsp;           &nb= sp; A
2          &nb= sp;           &nbs= p; 1          &nbs= p;     2         &n= bsp;           &nb= sp; B
3          &nb= sp;           &nbs= p; 1          &nbs= p;     3         &n= bsp;           &nb= sp; C
4          &nb= sp;           &nbs= p; 2          &nbs= p;     1         &n= bsp;           &nb= sp; A
5          &nb= sp;           &nbs= p; 2          &nbs= p;     2         &n= bsp;           &nb= sp; B
6          &nb= sp;           &nbs= p; 3          &nbs= p;     1         &n= bsp;           &nb= sp; A
7          &nb= sp;           &nbs= p; 3          &nbs= p;     2         &n= bsp;           &nb= sp; B
8          &nb= sp;           &nbs= p; 3          &nbs= p;     3         &n= bsp;           &nb= sp; C
9          &nb= sp;           &nbs= p; 3          &nbs= p;     4         &n= bsp;           &nb= sp; D
10          &n= bsp;           1&n= bsp;           &nb= sp;   4         &n= bsp;           &nb= sp; D
11          &n= bsp;           1&n= bsp;           &nb= sp;   5         &n= bsp;           &nb= sp; E
12          &n= bsp;           3&n= bsp;           &nb= sp;   5         &n= bsp;           &nb= sp; E
13          &n= bsp;           2&n= bsp;           &nb= sp;   3         &n= bsp;           &nb= sp; E
 
 
I want to create a sequence that = increases in unit=20 column 3 for each record individually in column = 2
 
How do i create a sequence that can = manage=20 this?
Is there a solution for = this?
 
 
Thanks
 
Oscar Uribe
 
 
 
 
 
 
 
 
 
 
------=_NextPart_000_0003_01C8AD22.94C39C80--