Re: Tricky math in PSQL - Mailing list pgsql-novice

From Kip Warner
Subject Re: Tricky math in PSQL
Date
Msg-id 1461635178.4255.5.camel@thevertigo.com
Whole thread Raw
In response to Re: Tricky math in PSQL  (Kevin Grittner <kgrittn@gmail.com>)
Responses Re: Tricky math in PSQL
List pgsql-novice
On Fri, 2016-04-22 at 14:37 -0500, Kevin Grittner wrote:
> Please include such information in the post, either directly or as
> an attachment.  Messages on these lists go back over 18 years at
> this point, and while you did flag that paste as "never delete",
> who's to say whether pastebin will be around to keep the promise
> that the URL will be valid 18 years from now?

Hey Kevin,

Noted. In general you are right. Because these queries are a bit long
and sometimes wrap in ugly ways in folks' MUAs making them harder to
read, you'll have to forgive me for this one.

> People can best help you if you provide a self-contained test case
> -- on that actually runs from an empty database.  You will get more
> responses, and are more likely to get to a good solution, if you
> simplify the example as far as possible while still showing the
> basic problem -- without ellipses or other non-executable visual
> cues.

Ok, it took me a while to figure out how to populate the tables with
sample random data, but I believe I have a complete self-contained
example that executes.

    http://pastebin.com/zwWmYMd0

The two tables statistics and statistics_child are populated with a
large number of rows.

Thank you for your help, Kevin.

--
Kip Warner -- Senior Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com


Attachment

pgsql-novice by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Tricky math in PSQL
Next
From: Merlin Moncure
Date:
Subject: Re: Tricky math in PSQL