0

this question may be weird or maybe unknown to me so i wanted to make sure is it possible or not . this is very basic query

select * from table;

and the output is like

id,
column1,
column2,
.
.
.

okay what i was thinking about json on mysql is there any way to subquery data and embed it into fields like this

select *,(select * from table2) as jsonData from table;

which outputs something like this 

Id,
column1,
column2,
jsonData = {
 "Id",
 "column1-of-table2",
 "column2-of-table2",
 .
 .
},
.  
.

since i have not done this kind of query in my sql ever so i am little curious about it , please mention if this is not clear, and any help would really help me
Thank you !!

  • Provide complete sample: CREATE TABLE for all tables, INSERT INTO with sample data (3-5 rows enough), desired output for this data. Do not forget to provide precise MySQL version. – Akina Jan 28 '22 at 06:13
  • Also mention relation between your tables is it 1:1 or 1:many – M Khalid Junaid Jan 28 '22 at 07:18

0 Answers0