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.

por Bhavani R -
Número de respostas: 8
Em resposta a '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.

por Conn Warwicker -
Foto de Core developers Foto de 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

Em resposta a '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.

por 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

Em resposta a '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.

por 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 ;

Em resposta a '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.

por Richard Oelmann -
Foto de Core developers Foto de Particularly helpful Moodlers Foto de Plugin developers Foto de Testers

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

Em resposta a '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.

por Bhavani R -

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

Em resposta a '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.

por Darko Miletić -
SELECT id, fullname
FROM mdl_course
WHERE timecreated > UNIX_TIMESTAMP(CURRENT_TIMESTAMP - INTERVAL 4 DAY) 
ORDER BY timecreated ASC;
Em resposta a '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.

por 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 ?

Em resposta a '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.

por 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 ;