gpt4 book ai didi

php - 查询生成器原始横向连接与 jsonb_to_recordset

转载 作者:行者123 更新时间:2023-12-02 17:06:09 27 4
gpt4 key购买 nike

希望是一个非常简单的问题。我正在尝试根据我的 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("...,但我遇到了很多小错误。我希望对我的实际问题有反馈。

最佳答案

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

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

关于php - 查询生成器原始横向连接与 jsonb_to_recordset,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51736923/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com