Re: generating the average 6 months spend excluding first orders

From: Ron256 <ejaluronaldlee(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: generating the average 6 months spend excluding first orders
Date: 2014-11-26 18:34:35
Message-ID: 1417026875109-5828394.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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-tp5828253p5828394.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Ron256 2014-11-26 19:26:20 Re: generating the average 6 months spend excluding first orders
Previous Message Ron256 2014-11-26 18:21:29 Re: generating the average 6 months spend excluding first orders