ml_chai
ml_chai

Reputation: 71

Cannot use the "over" clause with MySQL workbench 8.0 (MySQL version 5.7.31)

I struggle to see what I'm doing wrong. I have noticed that some syntax doesn't work (I've had this issue with the keywords "WITH" and now with "OVER".

I am applying a windowing function on a table with the columns id, price and cluster. I want to select the maximum price of a cluster. Here I use the "max" function as a toy example. (What I really want is the price with the greatest id for all cluster values.)

select max(price) over (cluster) as last_p
from transactions tx
right join tx_ids as ids ON ids.ids=tx.id
group by cluster
order by cluster;

I suspect the issue is with my version of workbench or mysql but haven't found much yet while searching for my problem online.

Simple windowing (analytic) MySQL application

Upvotes: -3

Views: 1412

Answers (1)

ml_chai
ml_chai

Reputation: 71

As pointed out by @GSerg, the windowing is not supported on MySQL 5.7.

It was introduced on MySQL 8. Ref: https://community.oracle.com/thread/4193269

Upvotes: 1

Related Questions