I am trying to using the NTILE function to create deciles in a dataset using Navicat for MySQL. My query is:

select NTILE(10) over (order by 'amount') decile, *
from dataframe d
order by 'amount';

I get the error

[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(order by.....

Can anyone help figure out what is wrong with my query?

Thanks in advance!

有帮助吗?

解决方案

NTILE is what is called a window function (MS SQL Info).

MySQL does not have window functions: https://dba.stackexchange.com/questions/40130/mysql-and-window-functions

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top