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!
Your
Datecolumn 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-ddformat, you could use something like this: