Postgres Window Function Previous Orders