N
N
ninja op op2021-01-12 15:49:21
MySQL
ninja op op, 2021-01-12 15:49:21

How to push all columns from JOIN into one column?

There are two tables:
ads
logs

is joined from logs to ads , and I need the resulting columns from ads to all fit in the "ad" column, so the final result in JSON would look like this:

{
"id": 1,
"column_1": 2,
"ad": {
"id": 1,
"column1": 2,
"column2": 3
}
}


How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Miron, 2021-01-13
@Miron11

Have you tried to search in Yandex?
I entered the query "MySQL for json" the expression "for json" is supported in SQL Server and it is considered the gold standard of the DBMS, so similar functions in other DBMS can be searched by keywords.
Here is the answer, I think it fits.
https://stackoverflow.com/questions/41758870/how-t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question