Re: [HACKERS] avg,first,last,median in one query

2016-03-24 Thread Jim Nasby
On 3/24/16 9:00 AM, Konstantin Knizhnik wrote: But unfortunately it is not possible to calculate median is such way because percentile_disc is not compatible with OVER: I don't know if you could use cume_dist()[1] to do this, but even if you can't it probably wouldn't be hard to modify it to

[HACKERS] avg,first,last,median in one query

2016-03-24 Thread Konstantin Knizhnik
Hi, hackers. I need advice from SQL experts: is there any way in PostgreSQL to calculate avg,first,last,median aggregates in one query? Assume that we have the following table: create table Securities ("Symbol" varchar, "Date" date, "Time" time, "Price" real); We can simulate median using