agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Mike Sofen <msofen@runbox.com>
To: 'Richard Klingler' <richard@klingler.net>
To: pgsql-sql@lists.postgresql.org
Subject: RE: Clean up shop database
Date: Wed, 19 Jan 2022 05:51:56 -0800
Message-ID: <122401d80d3b$ba859da0$2f90d8e0$@runbox.com> (raw)
In-Reply-To: <20220119143718285650.48772b27@klingler.net>
References: <20220119141711201637.c796844d@klingler.net>
<C586F023-3BD4-4488-A177-982458DFC133@gmail.com>
<20220119143718285650.48772b27@klingler.net>
> From: Richard Klingler <richard@klingler.net> Sent: Wednesday, January
19, 2022 5:37 AM
> On Wed, 19 Jan 2022 06:32:19 -0700, Rob Sargent wrote:
> >
> >> No it does not...but I assume it lists products that where at least
> >> ordered before January 1st 2021 as it contains lower product IDs.
> >>
> >> Hmm..gives me:
> >>
> >>> ERROR: function max(boolean) does not exist
> >> LINE 5: having max(o.orderdate < '2021-01-01')
> >>
> >>
> > Sorry
> >>
> >> max(o.orderdate )< '2021-01-01'
> >
> >>
> You're a genius :-)
> Looks perfect...
There is one caveat here: unless you are 100% certain that the
product.pieces count is 100% accurate, you should sum the
orderitems.productid. It is pretty common for the indirect counts (like
product.pieces) to get out of sync with the "normal" source of truth (line
items).
This does depend on design of your system, of course.
Mike
view thread (12+ messages) latest in thread
Message-ID: <122401d80d3b$ba859da0$2f90d8e0$@runbox.com>
Permalink: ../122401d80d3b$ba859da0$2f90d8e0$@runbox.com/
Also on: postgresql.org/message-id/122401d80d3b$ba859da0$2f90d8e0$@runbox.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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: msofen@runbox.com, richard@klingler.net, pgsql-sql@lists.postgresql.org
Subject: RE: Clean up shop database
In-Reply-To: <122401d80d3b$ba859da0$2f90d8e0$@runbox.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox