SQL query for top records using multiple columns
I have a Sqlite database that I want to query. My basic knowledge of SQL allows me to query most of what I need, but I'm stuck here:
The table looks like this (simplified!):
| Name | Year | Title | Musician 1 | Musician 2 |
| --------------- | ---- | ------- | ---------- | ----------- |
| Doe, Jon | 2007 | Title 1 | Beatles | The Stooges |
| May, Peter | 2001 | Title 2 | | Beatles |
| Schmidt, Andrea | 1997 | Title 3 | Nick Cave | |
I like to request Top Musician in the 2000s
and receive output like
| Name | Count |
| ----------- | ----- |
| Beatles | 2 |
| The Stooges | 1 |
How would you archive this? Thank!
+3
source to share