I am using sqlite3 database with the following table.
|name |action | ------------------------- |john |run | |jim |run | |john |run | |john |jump | |jim |jump | |jim |jump | |jim |dive |
I want to get this conclusion
|name |run |jump |dive | --------------------------------- |john |2 |1 |0 | |jim |1 |2 |1 |
The closest I came with this, but I would like to have one line as shown above.
SELECT name, action, COUNT(name) FROM table GROUP BY name, action |name |action |COUNT(name) | |john |run |2 | |john |jump |1 | |jim |run |1 | |jim |jump |2 | |jim |dive |1 |
In addition, I will also need to have WHERE statements in the request.
Did I really think it would work at night?
source share