Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5999551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:34:07+00:00 2026-05-23T00:34:07+00:00

I have a sqlite database. I have three columns:_id, date, value. I now want

  • 0

I have a sqlite database. I have three columns:_id, date, value.

I now want to extract a count of the _id:s depending on the day in the date, and calculate an average of the int value. This is for an Android app.

So I want to “select the day in date and for each day ( for sixty days), count how many _id:s there are for this day. Finally calculate the average of value.

I guess it is something like :

"SELECT DATE('now' 'days[i]') as date, COUNT(_id) as count,  AVG(value) as vl FROM v_efforts WHERE DATE(v_efforts.date) = DATE('now' 'days[i]')";

But I can’t get the 'days[i]' to work. I don’t know how i can get this value to increase to sixty, and then how I can store the count and vl for each of these sixty days.

THanks a lot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:34:08+00:00Added an answer on May 23, 2026 at 12:34 am

    You’ll want to use a GROUP BY expression to aggregate the entries by date. It’s not quite clear whether you’re looking for the last 60 days of entries in the database, or the entries from the last 60 real days (which would only be the same if you can assume that there are entries every day).

    For the former (last 60 days which had database entries), you can use a LIMIT clause:

    SELECT date,COUNT(_id),AVG(value) FROM v_efforts GROUP BY date ORDER BY date DESC LIMIT 60;
    

    For the latter (last 60 real days), you can use WHERE:

    SELECT date,COUNT(_id),AVG(value) FROM v_efforts WHERE date>DATE('now','-60 days') GROUP BY date ORDER BY date DESC;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My cose is SIMPLE. I have a SQLite-Database with three columns : rowid title
Lets say I have a database table which consists of three columns: id ,
I have an sqlite database full of huge number of URLs and it's taking
I am using the SQLite database and have the following persistent class (simplified): public
I use Netbeans IDE (6.5) and I have a SQLite 2.x database. I installed
I have a database file that is generated on a PC using Sqlite. This
I have created a Python module that creates and populates several SQLite tables. Now,
I have a large SQLite database with a mix of text and lots of
I have a SQLite database that contains a huge set of log messages. I
I have an SQLite3 database which, in order to optimize performance, uses computed columns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.