Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id D051A633407 for ; Fri, 4 Jun 2010 07:02:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 41076-03 for ; Fri, 4 Jun 2010 10:02:10 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [67.192.120.76]) by mail.postgresql.org (Postfix) with ESMTP id 8C91963336F for ; Fri, 4 Jun 2010 07:02:10 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=Content-Transfer-Encoding:Content-Type:Mime-Version:References:Message-ID:Date:Subject:From:To; bh=DtPfYyrnaaQ341sBxyAwWnmdPeZl5APhsSamofKpsJ0=; b=CpEcH/uM7lZ6TCyJybcYLcwLEFBpNbEfGhp8QA0Ip6idRdCbxrd+i8gfgZe/Ql8GaCjDcDZ5UiMdEDTsL8mWC+u1V+I1OveThh8Qp4UYHZm7nbfToX/lb73VHISm+qhs; Received: from ip-118-90-132-57.xdsl.xnet.co.nz ([118.90.132.57] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1OKTj5-0006Wu-NT; mid 144 for pgsql-sql@postgresql.org; Fri, 04 Jun 2010 10:01:44 +0000 Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1OKTiu-0005vL-PV for pgsql-sql@postgresql.org; Fri, 04 Jun 2010 22:01:56 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: how to construct sql Date: 4 Jun 2010 10:01:56 GMT Organization: Dis (not Dat) Organisation Lines: 22 Message-ID: References: <597755AB8EE8458F92F4B7C6588E5C03@marktestcr.marktest.pt> NNTP-Posting-Host: localhost Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: reversiblemaps.ath.cx 1275645716 22306 127.0.0.1 (4 Jun 2010 10:01:56 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-2 (Linux) X-Smtpcorp-Track: 3817573.1.42104462 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-5 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201006/19 X-Sequence-Number: 34210 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 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? from your original requirement 0 is the correct answer.