I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Bhavani R -
Number of replies: 8



 

.

Average of ratings: -
In reply to Bhavani R

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Conn Warwicker -
Picture of Core developers Picture of Plugin developers

1) Depends how are you defining "new"

2) Depends how are you defining "popular"

3) 

SELECT bi.id, b.name, bi.dateissued

FROM mdl_badge b

INNER JOIN mdl_badge_issued bi ON bi.badgeid = b.id

WHERE bi.userid = IDNUMBERHERE

In reply to Conn Warwicker

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Bhavani R -

Thanks conn ..

1)new means based on the timestamps that is one day and second one popular means based on the number of enrollments to the course..


--Bhavani

In reply to Bhavani R

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Bhavani R -

Hello Everyone i have written a query for fetching newly added course based on the time stamp.  Please let me know if i need to make any changes..

SELECT fullname
FROM mdl_course
ORDER BY timecreated ASC limit 2 ;

In reply to Bhavani R

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Richard Oelmann -
Picture of Core developers Picture of Plugin developers Picture of Testers

Well, other than the LIMIT 2 means it will only show you the last 2 courses...

In reply to Richard Oelmann

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Bhavani R -

yes richard... is there any method to limit on days...

In reply to Bhavani R

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Darko Miletić -
SELECT id, fullname
FROM mdl_course
WHERE timecreated > UNIX_TIMESTAMP(CURRENT_TIMESTAMP - INTERVAL 4 DAY) 
ORDER BY timecreated ASC;
In reply to Darko Miletić

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Bhavani R -

Thanks Darko,  I am searching a query that retrieves the popular courses names based on the number of enrollments to the courses. can i get a guidance on this ?

In reply to Bhavani R

Re: I am searching answer for below queries..let me know these queries. 1)List of newly added courses. 2)List of popular courses. 3)List of badges earned by the particular user.

by Bhavani R -

Hello Everyone,


I am trying with the below query for retrieving the popular courses based on the number of enrollments to the courses. someone please check this query where i am going wrong.


select c.fullname,count(e.courseid) from mdl_course c,mdl_enrol e where c.id=e.id group by e.courseid,c.fullname ;