Is it possible to count two columns?
I have a table that stores application names and which users have launched over time.
When querying a date range you end up with a result like the below example.
| App | User |
| App A | User A |
| App A | User A |
| App A | User B |
| App A | User C |
| App A | User D |
| App A | User D |
| App A | User D |
| App B | User A |
| App B | User E |
| App B | User F |
| App C | User A |
| App C | User C |
| App C | User C |
| App C | User C |
| App C | User F |
What I’m trying to get is one column that shows the number of app launches per app and another showing the number of users launching that app.
I can’t figure out how to do it.
Any one any ideas?
Example at SQL Fiddle.
The square brackets around
[User]are for SQL Server. Without them, you’d get your own username instead of theUsercolumn. In MySQL, you’d use backticks.