Answer the question
In order to leave comments, you need to log in
How to get json from two tables in database?
Let's say there is a database that has two tables 'author' and 'books'.
the 'books' table has the fields 'title' and 'author_id'.
You need to get json like:
{"title": "Book title", "name": "Author's name"}
Answer the question
In order to leave comments, you need to log in
Select * from avtor a, book b where b.autor_id=a.id
Neither and then collect the array and do json_encode
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question