I wish to pull just the quizzes in which the maxscore = score within the below query, are you able to please let me know what's wrong around the syntax?

$database->setQuery('SELECT distinct qui.title AS title,' .

        ' ( Choose GROUP_CONCAT(profiles.title)

              FROM #__jquarks_customers_profiles AS customers_profiles

              LEFT JOIN #__jquarks_profiles AS profiles ON customers_profiles.profile_id = profiles.id

              WHERE customers_profiles.user_id = sessionWho.user_id ) AS profile, ' .

        ' ( Choose sum(score)

              FROM #__jquarks_quizzes_answersessions

              WHERE quizsession_id = quizSession.id

              AND status <> -1 ) AS score,' .

        ' ( Choose count(distinct(question_id))

              FROM #__jquarks_quizzes_answersessions

              WHERE quizsession_id = quizSession.id ) AS maxScore,' .

            ' ( Choose count(id)

              FROM #__jquarks_quizzes_answersessions

              WHERE status=-1

              AND quizsession_id = quizSession.id ) AS evaluate,' .

' quizSession.finished_on,sessionWho.email' .

        ' FROM #__jquarks_quizsession AS quizSession' .

        ' LEFT JOIN #__jquarks_customers_quizzes AS customers_quizzes ON customers_quizzes.id = quizSession.affected_id' .

        ' LEFT JOIN #__jquarks_quizzes AS qui ON customers_quizzes.quiz_id = qui.id' .

        ' LEFT JOIN #__jquarks_quizzes_answersessions AS quizSessAns ON quizSessAns.quizsession_id = quizSession.id' .

        ' LEFT JOIN #__jquarks_sessionwho AS sessionWho ON sessionWho.session_id = quizSession.id' .

        ' LEFT JOIN #__jquarks_customers_profiles AS customers_profiles ON customers_profiles.user_id = sessionWho.user_id' .

' LEFT JOIN #__jquarks_profiles AS profiles ON profiles.id = customers_profiles.profile_id '.

' WHERE sessionWho.user_id =' .$id  AND score = maxScore)

The final part, AND score = maxScore isn't place in quotes. This ought to be a part of your SQL string.

It is simple to check this out even just in the highlighting that's put on the code inside your question, and surely the highlighter of the editor should reveil it too. Would you make use of an editor like NetBeans as well as Notepad++?

$database->setQuery('SELECT distinct qui.title AS title,' .

        ' ( Choose GROUP_CONCAT(profiles.title)

              FROM #__jquarks_customers_profiles AS customers_profiles

              LEFT JOIN #__jquarks_profiles AS profiles ON customers_profiles.profile_id = profiles.id

              WHERE customers_profiles.user_id = sessionWho.user_id ) AS profile, ' .

        ' ( Choose sum(score)

              FROM #__jquarks_quizzes_answersessions

              WHERE quizsession_id = quizSession.id

              AND status <> -1 ) AS score,' .

        ' ( Choose count(distinct(question_id))

              FROM #__jquarks_quizzes_answersessions

              WHERE quizsession_id = quizSession.id ) AS maxScore,' .

            ' ( Choose count(id)

              FROM #__jquarks_quizzes_answersessions

              WHERE status=-1

              AND quizsession_id = quizSession.id ) AS evaluate,' .

' quizSession.finished_on,sessionWho.email' .

        ' FROM #__jquarks_quizsession AS quizSession' .

        ' LEFT JOIN #__jquarks_customers_quizzes AS customers_quizzes ON customers_quizzes.id = quizSession.affected_id' .

        ' LEFT JOIN #__jquarks_quizzes AS qui ON customers_quizzes.quiz_id = qui.id' .

        ' LEFT JOIN #__jquarks_quizzes_answersessions AS quizSessAns ON quizSessAns.quizsession_id = quizSession.id' .

        ' LEFT JOIN #__jquarks_sessionwho AS sessionWho ON sessionWho.session_id = quizSession.id' .

        ' LEFT JOIN #__jquarks_customers_profiles AS customers_profiles ON customers_profiles.user_id = sessionWho.user_id' .

' LEFT JOIN #__jquarks_profiles AS profiles ON profiles.id = customers_profiles.profile_id '.

' WHERE sessionWho.user_id =' .$id . ' AND score = maxScore')

PS: Do your table names really have a #? Perhaps you should use back-quotes around individuals table names then, like:

LEFT JOIN `#__jquarks_customers_profiles`