agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Ron256 <ejaluronaldlee@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: generating the average 6 months spend excluding first orders
Date: Wed, 26 Nov 2014 11:34:35 -0700 (MST)
Message-ID: <1417026875109-5828394.post@n5.nabble.com> (raw)
In-Reply-To: <1417026089049-5828392.post@n5.nabble.com>
References: <1416970805198-5828253.post@n5.nabble.com>
<1416974013524-5828256.post@n5.nabble.com>
<1416977793450-5828259.post@n5.nabble.com>
<1417012543637-5828331.post@n5.nabble.com>
<1417023477345-5828381.post@n5.nabble.com>
<CAKFQuwbyE1=iByxRiUkeBZ474_aGEBgjaKZwqQUHLOf91OT2Dg@mail.gmail.com>
<1417024519548-5828385.post@n5.nabble.com>
<CAKFQuwafwdV3uqWgFy-ChXtdCO46WG+96yM2TCf9y4NBZGNOew@mail.gmail.com>
<1417025960949-5828390.post@n5.nabble.com>
<1417026089049-5828392.post@n5.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Using the following query,
SELECT o.persistent_key_str, o.ord_id
FROM orders o
WHERE o.ord_submitted_date in (
SELECT min(ord_submitted_date)ord_date
FROM orders
group by persistent_key_str)
I was able to generate the following output:
<http://postgresql.nabble.com/file/n5828394/First_time_orders.png;
The customer who placed two orders on the same date also appears in the
result set.
Thanks,
Ron
--
View this message in context: http://postgresql.nabble.com/generating-the-average-6-months-spend-excluding-first-orders-tp5828253p...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (14+ messages) latest in thread
Message-ID: <1417026875109-5828394.post@n5.nabble.com>
Permalink: ../1417026875109-5828394.post@n5.nabble.com/
Also on: postgresql.org/message-id/1417026875109-5828394.post@n5.nabble.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: ejaluronaldlee@gmail.com
Subject: Re: generating the average 6 months spend excluding first orders
In-Reply-To: <1417026875109-5828394.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox