agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Rob Sargent <robjsargent@gmail.com>
To: pgsql-sql@lists.postgresql.org
Subject: Re: Clean up shop database
Date: Wed, 19 Jan 2022 05:56:17 -0700
Message-ID: <72f379a3-0bba-b0fb-975c-d20b76d33fff@gmail.com> (raw)
In-Reply-To: <20220119134059286538.4c015b19@klingler.net>
References: <20220119120317479683.54287f97@klingler.net>
	<9713782b-9c29-2497-be30-6dd1af0d550c@gmail.com>
	<20220119134059286538.4c015b19@klingler.net>

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'

>






view thread (12+ messages)  latest in thread

Message-ID: <72f379a3-0bba-b0fb-975c-d20b76d33fff@gmail.com>
Permalink:  ../72f379a3-0bba-b0fb-975c-d20b76d33fff@gmail.com/
Also on:    postgresql.org/message-id/72f379a3-0bba-b0fb-975c-d20b76d33fff@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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: robjsargent@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: Clean up shop database
  In-Reply-To: <72f379a3-0bba-b0fb-975c-d20b76d33fff@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox