<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Some useful Moodle SQL Queries</title>
	<atom:link href="http://jrudd.org/2007/12/some-useful-moodle-sql-queries/feed/" rel="self" type="application/rss+xml" />
	<link>http://jrudd.org/2007/12/some-useful-moodle-sql-queries/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=some-useful-moodle-sql-queries</link>
	<description>Tools, Tips and Hints for managing a network.</description>
	<lastBuildDate>Sat, 12 May 2012 12:29:28 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: James Rudd</title>
		<link>http://jrudd.org/2007/12/some-useful-moodle-sql-queries/comment-page-1/#comment-138</link>
		<dc:creator>James Rudd</dc:creator>
		<pubDate>Wed, 14 Jul 2010 02:55:08 +0000</pubDate>
		<guid isPermaLink="false">http://jrudd.org/wordpress/2007/12/15/some-useful-moodle-sql-queries/#comment-138</guid>
		<description>I&#039;m glad they could be of use.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad they could be of use.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fire</title>
		<link>http://jrudd.org/2007/12/some-useful-moodle-sql-queries/comment-page-1/#comment-137</link>
		<dc:creator>Fire</dc:creator>
		<pubDate>Wed, 14 Jul 2010 01:07:20 +0000</pubDate>
		<guid isPermaLink="false">http://jrudd.org/wordpress/2007/12/15/some-useful-moodle-sql-queries/#comment-137</guid>
		<description>Hey thanks for this – I made a function to get all enrolled users using your info:

[php]
        function get_enrolled_users(){
            global $CFG;          
             $contextid = get_context_instance(CONTEXT_COURSE,$this-&gt;course_object-&gt;id);
             $cid=$contextid-&gt;id;
             $sql= &quot;SELECT u.firstname, u.lastname FROM {$CFG-&gt;prefix}user u INNER JOIN {$CFG-&gt;prefix}role_assignments ra ON ra.userid=u.id AND ra.contextid={$cid}&quot;;
             $enrolledUsers = get_records_sql($sql);
            return $enrolledUsers;
        }
[/php]</description>
		<content:encoded><![CDATA[<p>Hey thanks for this – I made a function to get all enrolled users using your info:</p>
<pre class="brush: php; title: ; notranslate">
        function get_enrolled_users(){
            global $CFG;
             $contextid = get_context_instance(CONTEXT_COURSE,$this-&gt;course_object-&gt;id);
             $cid=$contextid-&gt;id;
             $sql= &quot;SELECT u.firstname, u.lastname FROM {$CFG-&gt;prefix}user u INNER JOIN {$CFG-&gt;prefix}role_assignments ra ON ra.userid=u.id AND ra.contextid={$cid}&quot;;
             $enrolledUsers = get_records_sql($sql);
            return $enrolledUsers;
        }
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah Hunt</title>
		<link>http://jrudd.org/2007/12/some-useful-moodle-sql-queries/comment-page-1/#comment-130</link>
		<dc:creator>Sarah Hunt</dc:creator>
		<pubDate>Thu, 29 Apr 2010 10:26:55 +0000</pubDate>
		<guid isPermaLink="false">http://jrudd.org/wordpress/2007/12/15/some-useful-moodle-sql-queries/#comment-130</guid>
		<description>How to find out who created the course and who are the trainers?</description>
		<content:encoded><![CDATA[<p>How to find out who created the course and who are the trainers?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Birgit</title>
		<link>http://jrudd.org/2007/12/some-useful-moodle-sql-queries/comment-page-1/#comment-18</link>
		<dc:creator>Birgit</dc:creator>
		<pubDate>Thu, 14 Aug 2008 12:16:52 +0000</pubDate>
		<guid isPermaLink="false">http://jrudd.org/wordpress/2007/12/15/some-useful-moodle-sql-queries/#comment-18</guid>
		<description>Thanks a lot for those useful queries!!</description>
		<content:encoded><![CDATA[<p>Thanks a lot for those useful queries!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JDS</title>
		<link>http://jrudd.org/2007/12/some-useful-moodle-sql-queries/comment-page-1/#comment-17</link>
		<dc:creator>JDS</dc:creator>
		<pubDate>Mon, 30 Jun 2008 15:21:11 +0000</pubDate>
		<guid isPermaLink="false">http://jrudd.org/wordpress/2007/12/15/some-useful-moodle-sql-queries/#comment-17</guid>
		<description>Thanks, these were helpful!

You ought to state the SQL server and version of said server you are using, because some of these statements look like they have specific SQL server requirements. (e.g. sub-selects not available in MySQL &lt; 4.1)

It may be moot from the POV of MySQL (because the latest Moodle requires a MySQL version that can do this stuff) but you never know.

later..</description>
		<content:encoded><![CDATA[<p>Thanks, these were helpful!</p>
<p>You ought to state the SQL server and version of said server you are using, because some of these statements look like they have specific SQL server requirements. (e.g. sub-selects not available in MySQL &lt; 4.1)</p>
<p>It may be moot from the POV of MySQL (because the latest Moodle requires a MySQL version that can do this stuff) but you never know.</p>
<p>later..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

