From: Justin Graf <justin@magwerks.com>
To: Wes James <comptekki@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to construct sql
Date: Wed, 02 Jun 2010 15:44:22 -0500
Message-ID: <4C06C2A6.8080503@magwerks.com> (raw)
In-Reply-To: <AANLkTikQCTiXkz0n2wPp_kvK6KIf-rXngFb_7UDdfb0y@mail.gmail.com>
References: <AANLkTik3O3L0PLqy4SN5oHy9zSBf8TDLXzGZcPYLtEXf@mail.gma?= =?utf-8?Q?il.com>
<597755AB8EE8458F92F4B7C6588E5C03@marktestcr.marktest.pt?= =?utf-8?Q?>
<AANLkTikQCTiXkz0n2wPp=5FkvK6KIf-rXngFb=5F7UDdfb0y@mail.gmail.com>
On 6/2/2010 12:31 PM, Wes James wrote:
> On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros
> <oliveiros.cristina@marktest.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.
Attachments:justin.vcf (text/x-vcard, 256B) download
begin:vcard
fn:Justin Graf
n:Graf;Justin
org:Magwerks Corp
adr:;;501 Commerce Drive;Danville ;IN;46122;USA
email;internet:justin@magwerks.com
tel;work:317-241-8011 ext 703
tel;fax:317-241-8015
x-mozilla-html:FALSE
url:www.magwerks.com
version:2.1
end:vcard
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: justin@magwerks.com, comptekki@gmail.com
Subject: Re: how to construct sql
In-Reply-To: <4C06C2A6.8080503@magwerks.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox