agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Richard Klingler <richard@klingler.net>
To: pgsql-sql@lists.postgresql.org
Subject: RE: Clean up shop database
Date: Wed, 19 Jan 2022 14:59:52 +0100
Message-ID: <20220119145952950059.4dd93ada@klingler.net> (raw)
In-Reply-To: <122401d80d3b$ba859da0$2f90d8e0$@runbox.com>
References: <20220119141711201637.c796844d@klingler.net>
	<C586F023-3BD4-4488-A177-982458DFC133@gmail.com>
	<20220119143718285650.48772b27@klingler.net>
	<122401d80d3b$ba859da0$2f90d8e0$@runbox.com>

On Wed, 19 Jan 2022 05:51:56 -0800, Mike Sofen wrote:
>> 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
> 

Well I use the productid for rough checking so that they are created
some time before the specified date.

And I won't delete any records..just mark them as inactive...
that way datatables loads much faster when it just grabs the
active products via ajax call.







view thread (12+ messages)  latest in thread

Message-ID: <20220119145952950059.4dd93ada@klingler.net>
Permalink:  ../20220119145952950059.4dd93ada@klingler.net/
Also on:    postgresql.org/message-id/20220119145952950059.4dd93ada@klingler.net

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: richard@klingler.net, pgsql-sql@lists.postgresql.org
  Subject: RE: Clean up shop database
  In-Reply-To: <20220119145952950059.4dd93ada@klingler.net>

* 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