Issue with using percentile_cont function in Postgresql

This is my table

ID Total
1 2019.21
3 87918.32
2 562900.3
3 982688.98
1 56788.34
2 56792.32
3 909728.23

Now I would like to find the 25th,50th,75th,90th and 100th percentile of the values (Total) in the above Table. Assume my table consists of Whole Lot of data (some 2 Million Records of the same format) . I've Used the Following code :

CODE :

 SELECT  percentile_disc(0.5) WITHIN GROUP (ORDER BY Total) as disc_func
 FROM my_table

The Error I've come across :

ERROR: syntax error at or near "(" LINE 3: percentile_disc(0.5) WITHIN GROUP (ORDER BY total...

Upvotes: 1

Views: 650

Answers (1)

Related Questions