MDL-7531 Fix SQL that does not work in Oracle. Thanks to Mark Hetherington for the fix. Merged from MOODLE_17_STABLE.
MDL-7531 Fix SQL that does not work in Oracle. Thanks to Mark Hetherington for the fix. Merged from MOODLE_17_STABLE.

dilawar/moodle