From: | Richard Klingler <richard(at)klingler(dot)net> |
---|---|
To: | Rob Sargent <robjsargent(at)gmail(dot)com> |
Cc: | pgsql-sql(at)lists(dot)postgresql(dot)org |
Subject: | Re: Clean up shop database |
Date: | 2022-01-19 13:17:11 |
Message-ID: | 20220119141711201637.c796844d@klingler.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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')
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Sargent | 2022-01-19 13:32:19 | Re: Clean up shop database |
Previous Message | Rob Sargent | 2022-01-19 12:56:17 | Re: Clean up shop database |