On 12/12/2011 9:45 AM, Rafael Garcia Leiva wrote:
Now I need the Open and the Close of the 5 minutes interval, where Open
is the Open of the first minute of the interval, and Close is the Close
of the last minute of the interval.

Something like this:

select strftime('%Y-%m-%d %H:%M', min(date)) as Date,
  max(high) as High, min(Low) as Low,
max(case when strftime('%s', date) % (5*60) = 0 then open else null end) as Open, max(case when strftime('%s', date) % (5*60) = 4*60 then close else null end) as Close
from eurusd group by strftime('%s', date) / (5*60);

--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to