array(3) { [0]=> string(5) "42000" [1]=> int(1064) [2]=> string(228) "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '), total_friends AS ( SELECT COALESCE(COUNT(*), 0) AS totalFriends FROM ci...' at line 3" } SQL: [1524] WITH city_friends_geral AS ( SELECT fr.id FROM friends fr INNER JOIN users ON users.id = fr.user_id WHERE fr.city = '20888' AND fr.user_id > 0), city_friends_filtro AS ( SELECT fr.id FROM city_friends_geral fr WHERE ), total_friends AS ( SELECT COALESCE(COUNT(*), 0) AS totalFriends FROM city_friends_filtro ), friends_categories AS ( SELECT fcat.id, fcat.friend_id, fcat.category_id, categories.title, COUNT(*) AS total_ocorrencias FROM friends_categories fcat INNER JOIN city_friends_geral cf ON cf.id = fcat.friend_id INNER JOIN categories ON categories.id = fcat.category_id WHERE categories.active = 1 GROUP BY fcat.category_id ), friends_languages AS ( SELECT flan.id, flan.language_id, languages.en_title AS title, COUNT(*) AS total_ocorrencias FROM friends_languages flan INNER JOIN city_friends_geral cf ON cf.id = flan.friend_id INNER JOIN languages ON languages.id = flan.language_id GROUP BY flan.language_id ) SELECT JSON_OBJECT( 'totalFriends', (SELECT totalFriends FROM total_friends), 'interests', ( SELECT JSON_ARRAYAGG( JSON_OBJECT('category_id', category_id, 'title', title, 'total_ocorrencias', total_ocorrencias) ) FROM friends_categories ), 'languages', ( SELECT JSON_ARRAYAGG( JSON_OBJECT('language_id', language_id, 'title', title, 'total_ocorrencias', total_ocorrencias) ) FROM friends_languages ) ) AS result Params: 0

Erro: H6D87OEA