forked from hanochp/MusicStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2 reports.sql
More file actions
30 lines (20 loc) · 925 Bytes
/
2 reports.sql
File metadata and controls
30 lines (20 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--1. Total recording time this week
select sum(recording_duration) as total_recording_minutes
from Sessions
where session_date between dateadd(day, 1-datepart(weekday, getdate()), cast(getdate() as date))
and getdate();
--2. Total mixing time this week
select sum(mixing_time) as total_mixing_minutes
from Sessions
where session_date between dateadd(day, 1-datepart(weekday, getdate()), cast(getdate() as date))
and getdate();
--3. Number of sessions this week
select count(*) as num_sessions
from Sessions
where session_date between dateadd(day, 1-datepart(weekday, getdate()), cast(getdate() as date))
and getdate();
--4. Average session length
select avg(recording_duration) as avg_session_minutes
from Sessions
where session_date between dateadd(day, 1-datepart(weekday, getdate()), cast(getdate() as date))
and getdate();