【问题标题】:Query Builder Raw Lateral Join with jsonb_to_recordset使用 jsonb_to_recordset 查询生成器原始横向连接
【发布时间】:2019-01-15 03:25:15
【问题描述】:

希望是一个非常简单的问题。我正在尝试根据我的 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("...

【问题讨论】:

    标签: php jsonb laravel-query-builder lateral-join


    【解决方案1】:

    想通了。这是我需要附加到 Eloquent 查询构建器的内容

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

    【讨论】:

    • 完美!谢谢!
    猜你喜欢
    • 2020-01-25
    • 2019-06-08
    • 1970-01-01
    • 2021-12-26
    • 2017-12-28
    • 2019-11-03
    • 1970-01-01
    • 2016-11-16
    • 2015-05-09
    相关资源
    最近更新 更多