Re: [GENERAL] Select from tableA - if not exists then tableB - Mailing list pgsql-general

From Adrian Klaver
Subject Re: [GENERAL] Select from tableA - if not exists then tableB
Date
Msg-id cbd430e2-bc54-bfb8-b3b8-ba0b7f45a213@aklaver.com
Whole thread Raw
In response to [GENERAL] Select from tableA - if not exists then tableB  (Patrick B <patrickbakerbr@gmail.com>)
List pgsql-general
On 05/08/2017 02:56 PM, Patrick B wrote:
> 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?

If you can provide some information:

1) The table schema

2) How the data is related between the two tables.

>
>
> I'm using PostgreSQL 9.1.
>
> Thanks
> Patrick


--
Adrian Klaver
adrian.klaver@aklaver.com


pgsql-general by date:

Previous
From: Patrick B
Date:
Subject: [GENERAL] Select from tableA - if not exists then tableB
Next
From: David Rowley
Date:
Subject: Re: [GENERAL] Select from tableA - if not exists then tableB