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 8821759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:56:00+00:00 2026-06-14T05:56:00+00:00

I need to make a complex query, and I need help. Below is an

  • 0

I need to make a complex query, and I need help. Below is an example of what do i have:

id   |   Date   |  Validity

48   | 6-1-2009 |  notFound   
47   | 6-1-2009 |  valid   
46   | 6-1-2009 |  valid    
45   | 3-1-2009 |  invalid   
44   | 3-1-2009 |  invalid   
42   | 4-1-2009 |  notFound 
41   | 4-1-2009 |  notFound
48   | 4-1-2009 |  valid 

[Here come the SQL.]

And the query result would look like:

   Date   |  valid   |  invalid   |    notFound

 3-1-2009 |   0      |     2      |       0
 4-1-2009 |   1      |     2      |       2
 6-1-2009 |   3      |     2      |       3

Can i do this only in SQLite? Can someone help me? I’m working in Python.

I need this to generate a line graph out of it. The example would be: line chart!

  • 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-06-14T05:56:02+00:00Added an answer on June 14, 2026 at 5:56 am

    Your Date column cannot be properly sorted because it does not begin with the most significant field, the year.

    Assuming that you change the date to have a proper yyyy-mm-dd format, you could use something like this:

    SELECT A.Date,
           (SELECT COUNT(*) FROM MyTable AS B
            WHERE B.Date <= A.Date
              AND B.Validity = 'valid') AS valid,
           (SELECT COUNT(*) FROM MyTable AS B
            WHERE B.Date <= A.Date
              AND B.Validity = 'invalid') AS invalid,
           (SELECT COUNT(*) FROM MyTable AS B
            WHERE B.Date <= A.Date
              AND B.Validity = 'notFound') AS notFound
    FROM (SELECT DISTINCT Date FROM MyTable
          ORDER BY Date) AS A
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make a rather complex query, and I need help bad. Below
Intro I have a complex query I need to write (for an Oracle DB).
To make a long story short, I have some mildly complex queries (see example
I need to make a series (1-20) ajax calls and I need to have
Developing for iPhone, I have a collection of points that I need to make
I have a relatively complex query, with several self joins, which works on a
I have a somewhat complex query with multiple (nested) sub-queries, which I want to
I need to do a very complex query. At one point, this query must
I have a View that is pretty complex. The query pulls data from about
I need to make a complex filter that implies to apply a function over

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.