Skip to content

Tag: json

how to get sql result as objects

I have three tables: Table USER id name email Table CAMPUS id user_id (foreign key) name Table POST id title user_id (foreign key) A User belongs to a Campus, and a Post belong to a User. I want to write a query to fetch posts inner join with user inner join with campus. The result i get: [{ id username

Merge Two JSON array columns in Mysql 8

I am using Mysql (version > 8). I have a table where I am storing unique customer ids for the day in an JSON field as an array. I need to query for all unique customers in last 30 days. I am unable to find an equivalent mysql query for the same. I am using JSON_ARRAYAGG to first merge all

How to extract the information from JSon in MYSQL

I have Sample Data I’m getting Data Like this : I’m trying to get output like this : Can any one Suggest me . Answer In MySQL 8.0, you can use json_table() for this: Or if you want the results as a scalar value: In earlier versions, you would typically use a table of numbers and json_extract():