MDL-56516 tool_usertours: Adjust tour query for MySQL
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 25 Oct 2016 00:39:36 +0000 (08:39 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 25 Oct 2016 00:39:36 +0000 (08:39 +0800)
admin/tool/usertours/classes/cache.php

index 6c81a0a..cefc779 100644 (file)
@@ -61,10 +61,8 @@ class cache {
             $sql = <<<EOF
                 SELECT t.*
                   FROM {tool_usertours_tours} t
-            INNER JOIN {tool_usertours_steps} s ON s.tourid = t.id
                  WHERE t.enabled = 1
-              GROUP BY t.id
-                HAVING COUNT(s.id) > 0
+                   AND t.id IN (SELECT s.tourid FROM {tool_usertours_steps} s GROUP BY s.tourid)
               ORDER BY t.sortorder ASC
 EOF;