Re: What is the best way to merge two disjoint tables?

From: Rodrigo De León <rdeleonp(at)gmail(dot)com>
To: "Chansup Byun" <Chansup(dot)Byun(at)sun(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: What is the best way to merge two disjoint tables?
Date: 2007-09-07 19:46:52
Message-ID: a55915760709071246x1d57a519i94f0090f088e4060@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/7/07, Chansup Byun <Chansup(dot)Byun(at)sun(dot)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 of adding 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Collin Peters 2007-09-07 20:40:03 Auto vacuum documentation
Previous Message Chansup Byun 2007-09-07 18:34:51 Re: What is the best way to merge two disjoint tables?