Re: [GENERAL] Select from tableA - if not exists then tableB

2017-05-10 Thread Brian Dunavant
On Tue, May 9, 2017 at 6:00 PM, Patrick B wrote: > SELECT > split_part(n1.path::text, '/'::text, 18)::integer AS id, > split_part(n1.path::text, '/'::text, 14)::integer AS clientid, > lower(n1.md5::text)::character(32) AS md5, 0 AS cont, >

Re: [GENERAL] Select from tableA - if not exists then tableB

2017-05-09 Thread Patrick B
2017-05-09 10:19 GMT+12:00 Brian Dunavant : > From what you're saying about migrating, I'm assuming the new table > has additional columns or something. If you can map the difference, > then you could use CTE's to select from the first table, and if > nothing is there, then

Re: [GENERAL] Select from tableA - if not exists then tableB

2017-05-08 Thread Brian Dunavant
>From what you're saying about migrating, I'm assuming the new table has additional columns or something. If you can map the difference, then you could use CTE's to select from the first table, and if nothing is there, then pull from the second table and pad it with nulls so they "match". This

Re: [GENERAL] Select from tableA - if not exists then tableB

2017-05-08 Thread David Rowley
On 9 May 2017 at 09:56, 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

Re: [GENERAL] Select from tableA - if not exists then tableB

2017-05-08 Thread Adrian Klaver
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