Re: how to construct sql

From: Justin Graf <justin(at)magwerks(dot)com>
To: Wes James <comptekki(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: how to construct sql
Date: 2010-06-02 20:44:22
Message-ID: 4C06C2A6.8080503@magwerks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 6/2/2010 12:31 PM, Wes James wrote:
> On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros
> <oliveiros(dot)cristina(at)marktest(dot)pt> wrote:
>
>> Hi,
>> Have you already tried this out?
>>
>> select MAX(page_count_count) - MIN(page_count_count) from page_count group
>> by page_count_pdate.
>>
>>
>> Best,
>> Oliveiros
>>
> Oliveiros,
>
> Thx that mostly works. I just tried it and on the days there is only
> 1 entry it is 0 since max is the same as min so max - min is 0. Is
> there a way to take in to account the 1 entry days?
>
> Again thx - I appreciate your help :)
>
> -wes
>
>
Put in a 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)
from page_count
group by page_count_pdate.

All legitimate Magwerks Corporation quotations are sent in a .PDF file attachment with a unique ID number generated by our proprietary 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 information proprietary 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 that any unauthorized viewing, dissemination, distribution or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and destroy all occurrences of this e-mail immediately.
Thank you.

Attachment Content-Type Size
justin.vcf text/x-vcard 258 bytes

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Justin Graf 2010-06-02 21:45:16 Re: how to construct sql
Previous Message Wes James 2010-06-02 20:04:33 Re: how to construct sql