2

希望是一个非常简单的问题。我正在尝试根据我的 postgresql 查询在 Laravel 中创建一个查询,并且我很难转换这个特定的连接,因为它是使用 jsonb_to_recordset 的横向连接。

join lateral jsonb_to_recordset(gift_splits) as r("house_id" int, "amount" json) on true

这是我到目前为止所尝试的,它说我的论点太少了。我知道它会喜欢'a'、'='、'b',但我不确定如何将'on true' 翻译成那个以及连接的横向方面。

        ->join(DB::raw("lateral jsonb_to_recordset(gift_splits) as r(house_id int, amount json)"), true)

最后,我尝试将整个查询发布到 Model::raw(DB::raw("......

4

1 回答 1

6

弄清楚了。这是我需要附加到 Eloquent 查询构建器的内容

->crossJoin(DB::raw("横向 jsonb_to_recordset(gift_splits) as r(house_id int, amount json)"))

于 2018-08-10T22:42:14.910 回答