Mysql return JSON

0

I'm trying to make this example but it's giving the error: # 1582 - Incorrect parameter count in the call to native function 'JSON_OBJECT'

SELECT JSON_OBJECT('City', Name, 'Dist', District, 'Pop', Population) FROM City;

sql example returning Json

    
asked by anonymous 21.02.2018 / 13:01

1 answer

1

According to the documentation:

  

"Two aggregate functions generating JSON values are available (MySQL 5.7.22 and later)"

You can check the version of your mysql with this query:
show variables like '%version%';

According to what you said:

  

@MarceloRafael version Mysql 5.7.17 I did not know. I'll try to update then.

Tip: checks the Mysql version of your hosting.

    
24.02.2018 / 15:50