On Thu, Oct 13, 2022 at 08:04:03AM +, Eagna wrote:
>
> > > ERROR: syntax error at or near "WHERE"
> > > LINE 10: WHERE o.total_price > ISNULL(sub.paid, 0);
>
>
> > There error here is because a JOIN clause requires a join condition. Adding
> > an
> > "ON true" is probably what you want. You wo
> > ERROR: syntax error at or near "WHERE"
> > LINE 10: WHERE o.total_price > ISNULL(sub.paid, 0);
> There error here is because a JOIN clause requires a join condition. Adding an
> "ON true" is probably what you want. You would also need to change isnull()
> with coalesce().
> The final que
Hi,
On Thu, Oct 13, 2022 at 07:05:48AM +, Eagna wrote:
>
> relatively simple one would have thought! I tried to convert this into a
> Postgres query as follows:
>
> SELECT o.order_id,
> o.total_price - COALESCE(sub.paid, 0)
> FROM _order o
> LEFT JOIN LATERAL (
> SELECT SUM(p.amount) A