Re: [GENERAL] Merging timeseries in postgres

2016-07-15 Thread Tim Smith
eneral-ow...@postgresql.org > ] *On > Behalf Of *David G. Johnston > *Sent:* Thursday, 14 July, 2016 08:23 > *To:* Nick Babadzhanian > *Cc:* Tim Smith; pgsql-general > *Subject:* Re: [GENERAL] Merging timeseries in postgres > > > > On Thu, Jul 14, 2016 at 8:18 AM, Nick B

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread Begin Daniel
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of David G. Johnston Sent: Thursday, 14 July, 2016 08:23 To: Nick Babadzhanian Cc: Tim Smith; pgsql-general Subject: Re: [GENERAL] Merging timeseries in postgres On Thu, Jul 14, 2016 at 8:18 AM, Nick

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread David G. Johnston
On Thu, Jul 14, 2016 at 8:18 AM, Nick Babadzhanian wrote: > Whats exactly is wrong with the following query? > > select > dx date, > nx, > nx1 > from > test t > join test1 t1 on t.dx=t1.dx1 > ; > > ​Please don't top-post. test t join test1 t1 -- th

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread Nick Babadzhanian
Nevermind, I misunderstood your question. The answer is an outer join and if you want the exact output you provided then you can use the following clause. coalesce(dx, dx1) as date Is there any reason why these are two different tables? I'd consider changing data structure. - Original Mes

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread Nick Babadzhanian
Whats exactly is wrong with the following query? select dx date, nx, nx1 from test t join test1 t1 on t.dx=t1.dx1 ; - Original Message - From: "Tim Smith" To: "pgsql-general" Sent: Thursday, July 14, 2016 2:56:19 PM Subject: [GENERAL] Me

Re: [GENERAL] Merging timeseries in postgres

2016-07-14 Thread David G. Johnston
On Thu, Jul 14, 2016 at 7:56 AM, Tim Smith wrote: > > 2003-01-03 (null) 0.003 ​Where​ did the "0.003" come from? The result you are looking for works if you full outer join on dx1 - at least for the sample data. David J.