dbTalk Databases Forums  

[SQL] Running mean filtering using Window Functions?

mailing.database.pgsql-sql mailing.database.pgsql-sql


Discuss [SQL] Running mean filtering using Window Functions? in the mailing.database.pgsql-sql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Andreas Gaab
 
Posts: n/a

Default [SQL] Running mean filtering using Window Functions? - 04-26-2012 , 04:22 AM






Hi,

can I realize a running mean filter using window functions?

What I can think of is:

SELECT avg(random) OVER (PARTITION BY floor(time_s / 60) ORDER BY floor(time_s / 60))
FROM (
SELECT generate_series(0,600,20) time_s, random()
) as data;

which averages all measurements in one minute, but not every line with its following two lines.

Any suggestions?

Best regards
Andreas

__________________________________________________ _________________________

SCANLAB AG
Dr. Andreas Simon Gaab
Entwicklung * R & D

Siemensstr. 2a * 82178 Puchheim * Germany
Tel. +49 (89) 800 746-513 * Fax +49 (89) 800 746-199
mailto:a.gaab (AT) scanlab (DOT) de * www.scanlab.de<http://www.scanlab.de>

Amtsgericht München: HRB 124707 * USt-IdNr.: DE 129 456 351
Vorstand: Georg Hofner (Sprecher), Christian Huttenloher, Norbert Petschik
Aufsichtsrat (Vorsitz): Dr. Hans J. Langer
__________________________________________________ _________________________

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.