public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bob Edwards <[email protected]>
To: [email protected]
Subject: Re: losing my mind about sytnax error in window clause
Date: Wed, 8 Jun 2022 09:46:18 +1000
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMj5WPQDan-kuny1GGC5GWFt6jcOyrSbQHd+g0Ga15vqs8XjbA@mail.gmail.com>
References: <CAMj5WPQDan-kuny1GGC5GWFt6jcOyrSbQHd+g0Ga15vqs8XjbA@mail.gmail.com>

On 8/6/22 09:03, Rein Petersen wrote:
> Hi Folks,
> 
> I've been reading the docs over and again, searching exhaustively for 
> examples on the internet to help me here and I'm ready to give up.
> 
> I have a query using windows function:
> 
> SELECT
>      last_value ( typechange )      OVER w,
>      pindex,
>      lid,
>      last_value ( modified )   OVER w,
>      last_value ( created )    OVER w,
>      last_value ( modifiedby ) OVER w,
>      last_value ( createby )   OVER w,
>      last_value ( cost ) FILTER ( WHERE cost IS NOT NULL ) OVER w,
>      last_value ( sell ) FILTER ( WHERE sell IS NOT NULL ) OVER w
> FROM ps._delta_ext
> WHERE pindex = Ppindex AND
>      ( Plid IS NULL OR lid = Plid ) AND
>      ( Ptimestamp IS NULL OR modified <= Ptimestamp )
> GROUP BY lid, pindex
> WINDOW w AS ( PARITION BY lid, pindex ORDER BY created );
> Complains about syntax error in the WINDOW cause (last line) on 
> [PARTITION] BY:
> /* messages
> ERROR:  syntax error at or near "BY"
> LINE 16:  WINDOW w AS ( PARITION BY locationid, partindex ORDER BY cr...
>                                   ^
> SQL state: 42601
> Character: 2724
> */
> 
> Maybe my error is clear to someone else, could really use helping hand, 
> thanks.
> 
> Rein

PARITION <> PARTITION - check your spelling.

cheers,
Bob Edwards.

> 
> 
> 






view thread (6+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: losing my mind about sytnax error in window clause
  In-Reply-To: <[email protected]>

* 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