Laravel雄辩的LEFT JOIN WHERe NULL

Laravel雄辩的LEFT JOIN WHERe NULL,第1张

Laravel雄辩的LEFT JOIN WHERe NULL

可以通过指定特定表中所需的特定列名来解决,如下所示:

$c = Customer::leftJoin('orders', function($join) {      $join->on('customers.id', '=', 'orders.customer_id');    })    ->whereNull('orders.customer_id')    ->first([        'customers.id',        'customers.first_name',        'customers.last_name',        'customers.email',        'customers.phone',        'customers.address1',        'customers.address2',        'customers.city',        'customers.state',        'customers.county',        'customers.district',        'customers.postal_pre',        'customers.country'    ]);


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5022674.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存