Arturo
Arturo

Reputation: 5

MySQL 8 window functions syntax problems

I need to use window functions in MySQL. I'm using MySQL Server 8.0.11, and even the MySQL Workbench 8.0.11 (Development Release, not GA).

This should make Workbench available to read window functions. Before, they just worked, but I need them to be readable by Workbench in order to store them as procedures.

When I do a simple query, I keep getting:

"SELECT" is no valid input at this position for this server version, expecting: '(', WITH

But if I run the query, it works! It's just that I cannot store this as a procedure. You can see the query and the problem in the screenshot.

Screenshot

Can anyone help me? Thank you very much.

EDIT:

I added the screenshot so you could see where the error was appearing. Anyway, this is the code, and the error appears in the first SELECT:

SELECT * FROM   
     (SELECT * , row_number() over (PARTITION BY VendorID
       ORDER BY UpdateDate DESC) AS RowOrder    
        FROM vendors
     ) t1 
 Where RowOrder = 1 ;

Upvotes: 0

Views: 1108

Answers (1)

bassmann
bassmann

Reputation: 260

I was having troubles with Window functions in MYSQL 8.0.11 as well where they would execute as a workbench query but could not be saved to a SP.

This morning i upgraded both Server and Workbench to 8.0.12 and windows functions now work and I can save to SP. I recommend you give this a go.

Upvotes: 1

Related Questions