agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Richard Klingler <richard@klingler.net>
To: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Clean up shop database
Date: Wed, 19 Jan 2022 14:17:11 +0100
Message-ID: <20220119141711201637.c796844d@klingler.net> (raw)
In-Reply-To: <72f379a3-0bba-b0fb-975c-d20b76d33fff@gmail.com>
References: <20220119120317479683.54287f97@klingler.net>
<9713782b-9c29-2497-be30-6dd1af0d550c@gmail.com>
<20220119134059286538.4c015b19@klingler.net>
<72f379a3-0bba-b0fb-975c-d20b76d33fff@gmail.com>
On Wed, 19 Jan 2022 05:56:17 -0700, Rob Sargent wrote:
> On 1/19/22 05:40, Richard Klingler wrote:
>> Odd...gives me the same result....
>>
>> Tried another approach as the ordered is known where to start
>> from....but still the same:
>>
>> select p.productid as id, p.name_de as name
>> from product p, orderitems i,orders
>> where p.productid = i.orderitems2productid
>> and i.orderitems2orderid = orders.orderid
>> and orders.orderid < 14483
>> and p.pieces < 1
>> and p.active = 't'
>> group by id
>> order by id desc
>>
>> Still lists products after January 1st 2021...but I know what is going
>> on....
>
> (On this list top-posting is frowned upon. Inline or bottom-posting
> preferred.)
> The above query does not restrict order date?
>
> select p.*,max(o.orderdate)
> from product p join orderitem t on p.productid = t.orderitems2productid
> join order o on t.orderitems2orderid = o.orderid
> group by p.productid
> having max(o.orderdate < 'January 1 2021'
>
Ah sorry for that.....
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')
view thread (12+ messages) latest in thread
Message-ID: <20220119141711201637.c796844d@klingler.net>
Permalink: ../20220119141711201637.c796844d@klingler.net/
Also on: postgresql.org/message-id/20220119141711201637.c796844d@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, robjsargent@gmail.com, pgsql-sql@lists.postgresql.org
Subject: Re: Clean up shop database
In-Reply-To: <20220119141711201637.c796844d@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