android - Retrieving the total sum of a table item from a GROUP BY query -
i have 3 tables
private static final string dtreasontable = "create table tb_dtreasons(dtreasonid integer primary key autoincrement,dtreason text)"; private static final string configurationtable = "create table tb_config(configid integer primary key autoincrement," + "rawmaterialname text,output_pdt text,totalworkhrs real,quantity real,processstarttime real,outputquantity real,procesendtime real)"; private static final string downtimetable = "create table tb_downtimetable(dt_id integer primary key autoincrement,configid integer," + "starttime real,endtime real,dtreasonid integer)"; i want create report below

can me write procedure corresponding report generation?
public cursor getdtanalysisreport() { return this.data.rawquery("select endtime-starttime duration,tb_dtreasons.dtreason,count(tb_downtimetable.dtreasonid) tb_downtimetable" + " inner join tb_dtreasons on tb_downtimetable.dtreasonid = tb_dtreasons.dtreasonid group tb_downtimetable.dtreasonid ", null); } this tried i'm getting error. please me find solution.
select dtreason 'down time reason', sum(endtime - starttime) 'duration', sum(endtime - starttime) / (select sum(endtime - starttime) tb_downtimetable ) * 100 '% total down time', count(*) 'no of occurrences' tb_dtreasons join tb_downtimetable on tb_dtreasons.dtreasonid = tb_downtimetable.dtreasonid group tb_dtreasons.dtreasonid
Comments
Post a Comment