I have a query the calcuates number of KWH and the cost of energy used in the last 30 days. Right now the cost per KWH is hardcoded in the 2nd query at .19. What I really want to do is get the value from 'select kwhcost1 from applications;' store that as a variable/paramter and pass it into the send part of the query.
I have looked all over the place but all my google searchs return instructions on how to pass values into a sqlite query from C/PHP/python etc. I am just looking to pass a value from one query into a second. Is that possible? Can I modify the query below to get the two queries to work together so that the .19 is repalce by the kwhcost1 from the first query? select kwhcost1 from applications; SELECT monitordata_hourly.deviceaddress, Round(Sum(monitordata_hourly.ch1kwh),3) AS SumOfch1kwh, Round(Sum(monitordata_hourly.ch1kwh),3)*.19 AS SumOfch1kwh_cost FROM monitordata_hourly Where monitordata_hourly.deviceaddress=142265 and (datetime(monitordata_hourly.date))>=datetime('now', 'localtime', '-30 days') Group by monitordata_hourly.deviceaddress -- View this message in context: http://old.nabble.com/Passing-Value-from-one-query-to-another-tp27478736p27478736.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users