Re: [GENERAL] how to calculate standard deviation from a table

2015-01-22 Thread Rémi Cura
Are you sur you don't want a moving windows (stddev on 0 to 50 , then stdev on 1 to 51) .. If you don't want moving windows your query would look like DROP TABLE IF EXISTS your_data; CREATE TABLE your_data AS SELECT s as gid , random() as your_data_value FROM generate_series(1,1) as s ; SEL

Re: [GENERAL] how to calculate standard deviation from a table

2015-01-22 Thread Paul Jungwirth
Hi Pierre, How do you know in which group each row belongs? If you don't care how the rows are grouped, you can say this: create table foo (v float); insert into foo select random() from generate_series(1, 100) s(a); select n % 50 g, stddev(v) from (select row_number() over () n, v from foo)

Re: [GENERAL] how to calculate standard deviation from a table

2015-01-22 Thread David G Johnston
Pierre Hsieh wrote > Hi > > This table just has a column which type is integer. There are one million > data in this table. I wanna calculate standard deviation on each 50 data > by > order. It means SD1 is from data 1 to data 50, SD2 is from data 51 to > 100 Is there anyone who can give me so

[GENERAL] how to calculate standard deviation from a table

2015-01-22 Thread Pierre Hsieh
Hi This table just has a column which type is integer. There are one million data in this table. I wanna calculate standard deviation on each 50 data by order. It means SD1 is from data 1 to data 50, SD2 is from data 51 to 100 Is there anyone who can give me some suggestions? Thanks Pierre