Re: Select from tableA - if not exists then tableB

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Patrick B <patrickbakerbr(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Select from tableA - if not exists then tableB
Date: 2017-05-08 22:01:32
Message-ID: cbd430e2-bc54-bfb8-b3b8-ba0b7f45a213@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Rowley 2017-05-08 22:08:21 Re: Select from tableA - if not exists then tableB
Previous Message Patrick B 2017-05-08 21:56:19 Select from tableA - if not exists then tableB