I am trying to create a json string in store procedure,
below is my code:
SELECT
CONCAT("[",
GROUP_CONCAT(
CONCAT("{roomid:'",roomId,"'"),
CONCAT(",participant1:'",participant1),
CONCAT(",participant2:'",participant2),"'}")
)
,"]")
AS json FROM cmChatRooms;
I am following above link , and want out put like this
mysql throws syntax error and I am not able to get the error.
yupi i got that working, silly syntax mistake, corrected & now it worked as i wish
SELECT
CONCAT("[",
GROUP_CONCAT(
CONCAT("{roomid:'",roomId,"'"),
CONCAT(",participant1:'",participant1),"'}")
,"]")
AS json FROM cmChatRooms;