How can I count the # of course views by role?

Re: How can I count the # of course views by role?

by Matthew Willis -
Number of replies: 0
Hi Randy,

Thanks for the reply. My apologies for not replying sooner - just didn't see the notification!

So, how exactly would I go about doing that? E.g.

select
....
(select count(1) from mdl_logstore_standard_log lsl join mdl_role_assignments ra where ra.contextid = lsl.contextid and lsl.contextid = ct.id and ra.roleid = 5 and lsl.action = 'viewed') studenthits