Mysql return JSON

Asked

Viewed 197 times

0

I am trying to do this example but, is giving 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

  • @Marcelorafael Mysql version 5.7.17 I didn’t know. I’ll try to update then.

  • @Marcelorafael I updated the Mysql version. It was version 5.7.20-log and it worked perfectly. Thank you!

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 Mysql version 5.7.17 I didn’t know. I’ll try to update then.

Tip: checks the Mysql version of your hosting.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.