Re: What is the best way to merge two disjoint tables? - Mailing list pgsql-general

From Rodrigo De León
Subject Re: What is the best way to merge two disjoint tables?
Date
Msg-id a55915760709071246x1d57a519i94f0090f088e4060@mail.gmail.com
Whole thread Raw
In response to Re: What is the best way to merge two disjoint tables?  (Chansup Byun <Chansup.Byun@Sun.COM>)
List pgsql-general
On 9/7/07, Chansup Byun <Chansup.Byun@sun.com> wrote:
> One more question: Is there a way to make the  T2.U_ID + 1000  number to be incremental from a given number instead
ofadding 1000? 

See here:
http://archives.postgresql.org/pgsql-sql/2007-05/msg00194.php

Then, say we want to start from 49:

SELECT   COALESCE(T1.U_USER, T2.U_USER) AS U_USER
       , COALESCE(T1.U_ID
                , CASE
                    WHEN T2.U_ID IS NOT NULL
                      THEN 48 + ROWNUM()
                  END
                 ) AS U_ID
    FROM TABLEA T1 FULL JOIN TABLEB T2 ON T1.U_USER = T2.U_USER
ORDER BY U_ID

pgsql-general by date:

Previous
From: Chansup Byun
Date:
Subject: Re: What is the best way to merge two disjoint tables?
Next
From: "Collin Peters"
Date:
Subject: Auto vacuum documentation