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

  • Home
  • SEARCH
  • 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 7180951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:27:21+00:00 2026-05-28T17:27:21+00:00

my SQL skills aren’t strong enough to figure this out, hope someone can help.

  • 0

my SQL skills aren’t strong enough to figure this out, hope someone can help. This is on SQLite for Android:

I have a table ‘attempts’:

attempt_id | word | score | attempt_time
----------------------------------------
1          | w1   | 1     | 2011-09-01
2          | w1   | 2     | 2011-09-02
3          | w2   | 1     | 2011-09-02
4          | w3   | 1     | 2011-09-03
5          | w4   | 0     | 2011-09-03
6          | w1   | 0     | 2011-09-04

Each word has a score associated with it; I want to find the number of words that have a score >=1 for each day. Scores are preserved from day to do, so a score for day t should be reflected in day t+1. When a word goes to score 0, it should not be counted. The result should look something like this:

attempt_time | count(word)
--------------------------
2011-09-01   | 1              // w1 (1)
2011-09-02   | 2              // w1, w2 (2)
2011-09-03   | 3              // w1, w2, w3 (3)
2011-09-04   | 2              // w2, w3 (2) (w1 now has score 0)

There are lots of attempt_times, so you can’t loop through them individually. I suspect I need to use a subquery to sum the each date and the previous dates, but still need a way to discard duplicates (e.g. only count w1 once).

It should do something like this, but need all the dates rather than just one:

select count(distinct word) from attempts where score > 0 
and attempt_time <= '2011-09-03';

> 3

My alternative is to build a separate table that just keeps track of the totals on each day, but then I have to keep the data in sync.

Thanks much.

Edit: I’ve tried to add some more details to make the question more clear. Hope it helps.

  • 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-28T17:27:21+00:00Added an answer on May 28, 2026 at 5:27 pm

    It doesn’t seem like there’s a good way to do this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm inexperienced with SQL... i'm trying to figure out how to search my database
I'm trying to knock the rust off my SQL skills and need some help
My skills with SQL are simple, so i'm not sure how to do this..
I'm trying to do what seems simple, but my SQL skills are limited :)
Please forgive my ignorance and poor SQL programming skills but I am normally a
How would I do this in a stored procedure (SQL 2005): count = select
I'm trying to extract and make variables out of the thinking skills (like analyzing,
I'll be the first one to admit my SQL skills are lacking. Now... Let's
Ok.. So I'm trying to improve my SQL skills and have a question. Here
I have what I suspect is an easy problem, but my sql skills just

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.