Help me convert SQL statement to MySQL I have an application called Moodle version 1.9 and was migrated from Windows platform and Microsoft SQL Server to Linux and MySQL.

Now, when I click save changes the SQL query statement from Custom SQL, it gives me "Query failed". 

I would appreciate your help to advise how to fix the below SQL statement that I got from http://docs.moodle.org/22/en/ad-hoc_contributed_reports#All_Ungraded_Assignments_w.2F_Link

SELECT 
    u.firstname AS "First",
    u.lastname AS "Last",
    c.fullname AS "Course",
    a.name AS "Assignment",
    '&lt;a href="http://moodle.domain.com/mod/assignment/submissions.php' + char(63) +
        + 'id=' + cast(cm.id AS varchar) + '&amp;userid=' + cast(u.id AS varchar) +
        + '&amp;mode=single&amp;filter=0&amp;offset=2"&gt;' + a.name + '&lt;/a&gt;'
        AS "Assignmentlink"
FROM prefix_assignment_submissions AS asb
    JOIN prefix_assignment AS a ON a.id = asb.assignment
    JOIN prefix_user AS u ON u.id = asb.userid
    JOIN prefix_course AS c ON c.id = a.course
    JOIN prefix_course_modules AS cm ON c.id = cm.course
WHERE asb.grade &lt; 0 
    AND cm.instance = a.id 
    AND cm.module = 1
ORDER BY c.fullname, a.name, u.lastname
you should use concat to join strings.

this column:

'&lt;a href="http://moodle.domain.com/mod/assignment/submissions.php' + char(63) +
+ 'id=' + cast(cm.id AS varchar) + '&amp;userid=' + cast(u.id AS varchar) +
+ '&amp;mode=single&amp;filter=0&amp;offset=2"&gt;' + a.name + '&lt;/a&gt;'
AS "Assignmentlink"


in mysql should write as this:

concat('&lt;a href="http://moodle.domain.com/mod/assignment/submissions.php'，char(63) , 'id=' , cast(cm.id AS varchar) , '&amp;userid=' , cast(u.id AS varchar)  , '&amp;mode=single&amp;filter=0&amp;offset=2"&gt;' , a.name , '&lt;/a&gt;')
AS "Assignmentlink"