【发布时间】:2018-12-19 09:37:31
【问题描述】:
我有 2 张桌子。名为“places”的主表:
还有一个名为“place_meta”的辅助表:
查询地点时,我想将place_meta 表中具有相同place_id 的行附加到地点结果中。它应该看起来像:
{
id: 1,
slug: "test",
status: "active",
name: "test",
excerpt: "blah blah",
description: "bla blah blah",
test_url: "https://test.de",
test2_url: "https://test2.de"
}
或喜欢
{
id: 1,
slug: "test",
status: "active",
name: "test",
excerpt: "blah blah",
description: "bla blah blah",
meta: {
test_url: "https://test.de",
test2_url: "https://test2.de"
}
}
用 join 尝试过,但真的不知道如何如愿以偿。
【问题讨论】: