pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Broersma <richard.broersma@gmail.com>
To: Colin Copeland <copelco@caktusgroup.com>
Cc: pgsql-performance@postgresql.org, "team@caktusgroup.com s" <team@caktusgroup.com>
Subject: Re: query planner and scanning methods
Date: Wed, 24 Sep 2008 12:22:49 -0700
Message-ID: <396486430809241222x65c13e33j80f8c0fc7c6e7039@mail.gmail.com> (raw)
In-Reply-To: <396486430809231557j25541f06q845e017553fc44d2@mail.gmail.com>
References: <8559E6C3-47ED-40E4-99E6-C56B322310DA@caktusgroup.com>
	<396486430809231507t46edf20fxab469bedbd78e8cc@mail.gmail.com>
	<6D0802D6-371A-470C-AB1C-3CC20E543061@caktusgroup.com>
	<396486430809231557j25541f06q845e017553fc44d2@mail.gmail.com>

On Tue, Sep 23, 2008 at 3:57 PM, Richard Broersma
<richard.broersma@gmail.com> wrote:
> SELECT A."dimension_book"."call", SUM( B."dimension_book"."call" ) AS
> OrderedRowNbr
> FROM ( your_above_query_without_the_limits ) AS A
> INNER JOIN ( your_above_query_without_the_limits ) AS B
> ON A."dimension_book"."call" >= B."dimension_book"."call"
> ORDER BY A."dimension_book"."call"
> HAVING SUM( A."dimension_book"."call" ) % 10 = 0;

Oops I just noticed that I used sum() where count() should be used and
that I forgot to include the group by clause.  Other than that, I hope
the suggestion was at least halfway helpful.

-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug



view thread (5+ messages)

Message-ID: <396486430809241222x65c13e33j80f8c0fc7c6e7039@mail.gmail.com>
Permalink:  ../396486430809241222x65c13e33j80f8c0fc7c6e7039@mail.gmail.com/
Also on:    postgresql.org/message-id/396486430809241222x65c13e33j80f8c0fc7c6e7039@mail.gmail.com

 · 

reply

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: richard.broersma@gmail.com, copelco@caktusgroup.com, team@caktusgroup.com
  Subject: Re: query planner and scanning methods
  In-Reply-To: <396486430809241222x65c13e33j80f8c0fc7c6e7039@mail.gmail.com>
  References: <8559E6C3-47ED-40E4-99E6-C56B322310DA@caktusgroup.com> <396486430809231507t46edf20fxab469bedbd78e8cc@mail.gmail.com> <6D0802D6-371A-470C-AB1C-3CC20E543061@caktusgroup.com> <396486430809231557j25541f06q845e017553fc44d2@mail.gmail.com> <396486430809241222x65c13e33j80f8c0fc7c6e7039@mail.gmail.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