Re: [GENERAL] Combining data from Temp Tables

2012-02-21 Thread David Johnston
Sent: Tuesday, February 21, 2012 2:04 PM To: 'Andy Colson'; Jeff Herman Cc: pgsql-general@postgresql.org Subject: RE: [GENERAL] Combining data from Temp Tables -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of

Re: [GENERAL] Combining data from Temp Tables

2012-02-21 Thread Jeff Herman
PM To: 'Andy Colson'; Jeff Herman Cc: pgsql-general@postgresql.org Subject: RE: [GENERAL] Combining data from Temp Tables -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, February 21, 2

Re: [GENERAL] Combining data from Temp Tables

2012-02-21 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Andy Colson Sent: Tuesday, February 21, 2012 1:37 PM To: Jeff Herman Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Combining data from Temp Tables how about

Re: [GENERAL] Combining data from Temp Tables

2012-02-21 Thread Andy Colson
how about select date, ln, mbrid, ds, ( select sum(ds) from t2 where t2.date >= t1.date and t2.date <= t1.date + '5 days'::interval and t1.ln = t2.ln and t1.mbrid = t2.mbrid) from t1 That'll give you both the plus and minus (in two different columns), but it might sum up the same row f

Re: [GENERAL] Combining data from Temp Tables

2012-02-21 Thread Andy Colson
: 734.973.0137 ext 441 Fax: 734.975.1248 herm...@hvpa.com *From:*pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] *On Behalf Of *Jeff Herman *Sent:* Tuesday, February 21, 2012 12:04 PM *To:* pgsql-general@postgresql.org *Subject:* [GENERAL] Combining data from Temp Tables

Re: [GENERAL] Combining data from Temp Tables

2012-02-21 Thread Jeff Herman
...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Jeff Herman Sent: Tuesday, February 21, 2012 12:04 PM To: pgsql-general@postgresql.org Subject: [GENERAL] Combining data from Temp Tables Hi all, I have created two temp tables that I would like to combine to make a third temp table and

[GENERAL] Combining data from Temp Tables

2012-02-21 Thread Jeff Herman
Hi all, I have created two temp tables that I would like to combine to make a third temp table and am stuck on how to combine them to get the results I want. Any guidance you could give would be appreciated. Temp Table 1