Вопрос

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