In this blog post, you’ll learn more about the Sybase Error Window function used in predicate and the reason for receiving this error
Sybase SQL Error Message
Window function used in predicate
Reason for this Error
A window function was used in the WHERE or HAVING clause of a SELECT statement. Consider making the SELECT into a derived table, putting the window function in the SELECT list of the derived table, and changing the predicate to reference the derived column.