I'm analyzing a database of login records for a university and I'm trying to write a query that will give me an idea as to how many users are using the labs for short bursts, verse a more extended stay.
I have the query below query, which tells me how many times each user has used a lab for less than or equal to 10 minutes. What I want is a result that tells me this and their total number of logins.
select username, count(*) as "<= 10 min"
from logins
where duration<="600"
group by username
order by username asc
limit 10;
Example desired output:
+----------+----------+----------+
| username | <=10 Min | total |
+----------+----------+----------+
| user1 | 4 | 7 |
| user2 | 11 | 22 |
| user3 | 1 | 3 |
| user4 | 4 | 8 |
+----------+----------+----------+