Sqlite SUM with GROUP BY

You must Login before you can answer or comment on any questions.

I am having problems using the SQlite SUM function together with a GROUP BY clause. The following query works find using SQLite Manager, where it returns 3 rows for my three different varieties but in Titanium, I only get one row.

var returnData =[];     
var rows = conn.execute('SELECT DrugVariety, SUM(totalUnits) as SumUnits from DoseageLog where DrugVariety != "NULL" and DoseageChanged > ? and DoseageChanged < ?', minTime, maxTime);
return returnData;
Am I doing something wrong?

1 Answer

Accepted Answer

It might just be me, but I do not see the GROUP BY clause in your code that you mentioned in the question. That might be why you are only getting one result.

Your Answer

This question has been locked and cannot accept new answers.