Select from tableA - if not exists then tableB

From: Patrick B <patrickbakerbr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Select from tableA - if not exists then tableB
Date: 2017-05-08 21:56:19
Message-ID: CAJNY3ivutOr4cGVOkNjR13rC23F-UiqAKEwOD=hHZvM6Ud8ubQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi guys,

I have two tables that supports the same data, but different table DDL (We
are migrating all the data from one to another).

What I need is basically:

1. Query looks for the data on table A,
2. if it doesn't find it on table A, go look for it on table B

Now, how could I do that in a Select? Can you please provide some examples?

I'm using PostgreSQL 9.1.

Thanks
Patrick

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-05-08 22:01:32 Re: Select from tableA - if not exists then tableB
Previous Message Adrian Klaver 2017-05-08 21:49:51 Re: data transformation and replication