string(679) "
SELECT mc.id as id, shortname, remoteid, cat_name, catid, cost, summary_files, summary, fullname, attribs
FROM `#__moojla_course` AS `mc`
LEFT JOIN `#__moojla_tag_instance` AS `mti`on`mc`.`remoteid`=`mti`.`moojlacourse`
LEFT JOIN `#__moojla_tag` AS `mt`on`mti`.`moodletag`=`mt`.`tagid`
LEFT JOIN `#__moojla_enrolment` AS `e`on`mc`.`remoteid`=`e`.`moojlacourse`
LEFT JOIN `#__moojla_user_map` AS `um`on`e`.`jid`=`um`.`jid`
LEFT JOIN `#__users` AS `u`on`e`.`jid`=`u`.`id`
LEFT JOIN `#__categories` AS `c`on`mc`.`catid`=`c`.`id`
INNER JOIN `#__moojla_favorite` AS `mf` on `mc`.`remoteid`=`mf`.`courseid`
WHERE `mc`.`published`=1
GROUP BY remoteid
ORDER BY mc.remoteid desc LIMIT 12"