Help with SQL Queries for a Novice.

Help with SQL Queries for a Novice.

by Deepak Bhalla -
Number of replies: 0

Hi !

I need a big help from my friends here. Our Moodle Site is serving apprx 30 thousand students from 29 different yet connected institutions. I have now been asked to prepare certain reports for which I have installed the ad-hoc reports query plugin however I am a novice as far as SQL is concerned hence I need help with SQL queries as the ones available under contributed reports are not suitable for my requirements.

I will be grateful if someone can help create the following queries ;

1. To get the list of active student accounts (not suspended) accounts where profile_field_institutionname (Custom Profile field) = School A and profile_field_rolename="Student" AND profile_field_ecourse="Class XYZ"

2. To get the list of active staff accounts (not suspended )  where profile_field_institutionname (Custom Profile field) = "School A" and profile_field_rolename="Staff".

3. To get the list of no. of logins and activities undertaken (add, update, delete) by staff (profile_field_rolename="Staff") of a particular institution(profile_field_institutionname="School A") between date1 and date2.

4. To get the list of (active accounts) students who have never logged in. for a particular institute(category) where  profile_field_institutionname = "School A" AND profile_field_ecourse="Class *" .

5. To get the list of (active accounts) Staff who have never logged in. for a particular institute(category) where  profile_field_institutionname = "School A".

Earlier I was preparing these reports manually by using filters available in the Browse Users section however now, as we are moving towards automation of a few things I am required to make and run these queries through SQL.

Further, is there any way we can increase the number of rows for the report from 5000 to 30000 ?

Please help.

Thanks and Regards

Deepak Bhalla

New Delhi

Average of ratings: -