Re: how to construct sql - Mailing list pgsql-sql

From Justin Graf
Subject Re: how to construct sql
Date
Msg-id 4C06D0EC.9050206@magwerks.com
Whole thread Raw
In response to Re: how to construct sql  (Wes James <comptekki@gmail.com>)
List pgsql-sql
On 6/2/2010 2:52 PM, Wes James wrote:
>
>   **snip***
> Thx it is closer (with an end in the case):
>
> select
> case when MAX(page_count_count) - MIN(page_count_count)>  0 then
>         MAX(page_count_count) - MIN(page_count_count)
> else
>         MAX(page_count_count)
> end as day_max
> from page_count
> group by page_count_pdate order by page_count_pdate;
>
> the else puts out the total count on that day.  I would need
> max(page_count_count) - max(page_count_count_of_previous_day)
>
> thx,
>
> -wes
>

A windowing query makes sense in this case  which i'm not very good at



All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by
ourproprietary quotation system. Quotations received via any other form of communication will not be honored. 

CONFIDENTIALITY NOTICE: This e-mail, including attachments, may contain legally privileged, confidential or other
informationproprietary to Magwerks Corporation and is intended solely for the use of the individual to whom it
addresses.If the reader of this e-mail is not the intended recipient or authorized agent, the reader is hereby notified
thatany unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have
receivedthis e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this
e-mailimmediately. 
Thank you.

Attachment

pgsql-sql by date:

Previous
From: Wes James
Date:
Subject: Re: how to construct sql
Next
From: Harald Fuchs
Date:
Subject: Re: inner join and limit