Jump to content

mysql to json


Destramic

Recommended Posts

hey guys im trying to get this query working but im getting an error if anyone could tell me whats going wrong please....thank you

 

SELECT 
     CONCAT("[",
          GROUP_CONCAT(
               CONCAT("{platform_abbreviation:'", gp.platform_abbreviation,"'"),
               CONCAT(",game_name:'", g.game_name),
               CONCAT(",game_abbreviation:'", g.game_abbreviation),"'}")
          )
     ,"]") 
AS json
FROM game_platform_mappings gpm
LEFT JOIN game_platforms gp ON gp.game_platform_id = gpm.game_platform_id
LEFT JOIN games g ON g.game_id = gpm.game_id

 

error im getting

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AS json FROM game_platform_mappings gpm LEFT JOIN game_platforms gp ON gp.gam' at line 8
Link to comment
https://forums.phpfreaks.com/topic/251279-mysql-to-json/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.