我正在尝试使用sqlite3执行联合查询。我希望响应模仿我从ORM得到的结果,例如续集,即:
{
"id":1,
"name":"table",
"table1":{
"id":1,
"column":"foo",
"column2":"bar"
},
"created_at":"2015-10-03 06:13:31"
}
这是我尝试过的查询:
SELECT * FROM table
JOIN table1 on table1.id = table.table1_id;
运行此查询时,我得到以下格式的响应:
{
"id": 1,
"name": "table",
"created_at": "2015-10-03 06:13:31",
"table1_id": 1,
"column": "foo",
"column2": "bar",
}
如何将table1中的内容分组为返回的响应中的对象?