Hi gurus, I have a database from which I get two (integer) values, one from today and the second from same time yesterday:
SELECT kwh_th FROM werte WHERE STRFTIME('%Y-%m-%d %H:%M', timestamp) = STRFTIME('%Y-%m-%d %H:%M', 'now', 'localtime', '-1 minute'); SELECT kwh_th FROM werte WHERE STRFTIME('%Y-%m-%d %H:%M', timestamp) = STRFTIME('%Y-%m-%d %H:%M', 'now', 'localtime', '-1 days', '-1 minute'); The two numbers are correct. How can I get the difference of those two numbers instead of the two numbers as result of the SQL statement? I was trying with parenthesizing but without luck. (SELECT ... ) - (SELECT ... -1 day ...); Also I was thinking about using variables like: today = SELECT ...; yesterday = SELECT ...; print yesterday - today; But I could not find informations which got me solving this. Is there a way to do this in a SQL statement or do I have to use a programming language on top of the sqlite level? Regards Mathh _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users