Hi I am working with sqlite. I alredy stored some fields in sqlite when i retrving the data the average values not assigned the values.
cursor = database.rawQuery("Select '"+start+"' as dateadded ,AVG('ch4') as 'ch4',AVG('c2h2') as 'c2h2',AVG('c2h4') as 'c2h4' where dateAdded between '"+start+"' and '"+end+"' and '"+edd+"' = '"+equipid+"' ",null);
I wrote like this it is return the value but that is not correct. I think the problem is i am not wrote any table name.
When i executing the code in the sqlite that is return only dateadded and remaning all are null.
Select '02-07-14 11:58' as dateadded ,AVG('ch4') as ch4,AVG('c2h2') as c2h2,AVG('c2h4') as c2h4 where dateAdded between '02-07-14 11:58' and '03-07-14 11:58' and "equipid" = '2'
If i write the code like
Select '02-07-14 11:58' as dateadded ,AVG('ch4') as ch4,AVG('c2h2') as c2h2,AVG('c2h4') as c2h4 where dateAdded between '02-07-14 11:58' and '03-07-14 11:58' and "equipid" = '2' FROM dgadata
The dgadata is the table name. But that is showing the like
Error:near "FROM": syntax error:
So can you please tell me how can i write the query for average of values in android sqlite.
Thank You
Shankar