My table is structure is as follows:
@Entity(tableName = "userFitnessDailyRecords")
public class UserFitnessDailyRecords {
@NonNull
@PrimaryKey
private Date forDay;
private int stepCount;
}
The query I am writing for getting sum and average is as follows:
@Dao
public interface UserFitnessDailyRecordsDao {
@Query("SELECT SUM(stepCount), AVG(stepCount) FROM userFitnessDailyRecords where forDay BETWEEN :startDay AND :endDay ORDER BY forDay ASC")
UserFitnessDailyRecords getUserFitnessSumAndAverageForLastThirtyDays(Date startDay, Date endDay);
@Query("DELETE FROM userFitnessDailyRecords")
void deleteUserFitnessDailyRecord();
}
Upon compiling I get an error unable to return values as columns do not contain sum and average field. How does one return sum and average in this case?