El 12/12/2011 17:13, Igor Tandetnik escribió:
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);


Yes, that works!

However it works only if there is no missing data, but this is not the case in Forex. The last minute of the interval is not necessarily the fifth element.

Anyway, many thanks for your help.

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

Reply via email to