Re: generating the average 6 months spend excluding first orders

Поиск
Список
Период
Сортировка
От Ron256
Тема Re: generating the average 6 months spend excluding first orders
Дата
Msg-id 1417029980347-5828407.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: generating the average 6 months spend excluding first orders  (Ron256 <ejaluronaldlee@gmail.com>)
Список pgsql-sql
David,

I have modified the first query to my needs and I believe, it gives the
correct results for the first time orders.

accept


WITH first_cust_cte AS 
(        SELECT min(ord_submitted_date)ord_date                , persistent_key_str        FROM orders        group by
persistent_key_str
 
) 
SELECT o.persistent_key_str, o.ord_id FROM orders o INNER JOIN first_cust_cte c ON o.persistent_key_str =
c.persistent_key_strAND  o.ord_submitted_date =
 
c.ord_date

Thanks for your support.

Thanks,

Ron



--
View this message in context:
http://postgresql.nabble.com/generating-the-average-6-months-spend-excluding-first-orders-tp5828253p5828407.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



В списке pgsql-sql по дате отправления:

Предыдущее
От: Tim Dudgeon
Дата:
Сообщение: Re: Querying with arrays
Следующее
От: Jason Aleksi
Дата:
Сообщение: regr_slope function with auto creation of X column