Re: [SQL] how to construct sql

2010-06-04 Thread Jasen Betts
On 2010-06-02, Wes James wrote: > On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros > 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

Re: [SQL] how to construct sql

2010-06-02 Thread Justin Graf
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 pa

Re: [SQL] how to construct sql

2010-06-02 Thread Wes James
On Wed, Jun 2, 2010 at 1:51 PM, Plugge, Joe R. wrote: > This is discussed in this Wiki: > > > http://wiki.postgresql.org/wiki/Grouping_Sets > This would sum the results and would be incorrect. I also get this error: select sum(page_count_count), page_count_pdate from page_count group by rollup(

Re: [SQL] how to construct sql

2010-06-02 Thread Wes James
On Wed, Jun 2, 2010 at 2:44 PM, Justin Graf wrote: > On 6/2/2010 12:31 PM, Wes James wrote: >> On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros >>  wrote: >> >>> Hi, >>> Have you already tried this out? >>> >>> select MAX(page_count_count) - MIN(page_count_count)  from page_count group >>> by page_coun

Re: [SQL] how to construct sql

2010-06-02 Thread Plugge, Joe R.
@postgresql.org Subject: Re: [SQL] how to construct sql db2 has a group by rollup function.. does this exist in postgres? -Original Message- From: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Oliveiros Sent: Wednesday, June 02, 2010 11:55 AM To: Wes James

Re: [SQL] how to construct sql

2010-06-02 Thread Hiltibidal, Rob
to construct sql 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 - Original Message - From: "Wes James" To: Sent: Wednesday, June 02, 2010 5:48 PM Subject: [SQL] how to

Re: [SQL] how to construct sql

2010-06-02 Thread Justin Graf
On 6/2/2010 12:31 PM, Wes James wrote: > On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros > 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,

Re: [SQL] how to construct sql

2010-06-02 Thread Wes James
On Wed, Jun 2, 2010 at 10:55 AM, Oliveiros 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 on

Re: [SQL] how to construct sql

2010-06-02 Thread Oliveiros
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 - Original Message - From: "Wes James" To: Sent: Wednesday, June 02, 2010 5:48 PM Subject: [SQL] how to construct s

[SQL] how to construct sql

2010-06-02 Thread Wes James
I am grabbing a printer total and putting it in a table. The page_count is continuously increasing: page_count_countpage_count_pdate 10 2010-05-10 20 2010-05-10 40 2010-05-11 60