【发布时间】:2016-05-30 06:36:50
【问题描述】:
如果我将 where 子句添加到左连接,则该 where 子句适用于右表,我只能从左表中获得与右表匹配的结果。
$notifications = \DB::table('notifications')
->select(\DB::raw("notifications.uuid ,images.local_path as title_image" ))
->leftJoin('images','images.owner_uuid', '=' ,'notifications.uuid')
where('images.relation','=','notification_title') ;
我怎样才能将这个 where 子句添加到左连接,这不会产生这个问题?
where('images.relation','=','notification_title') ;
【问题讨论】:
-
在
leftJoin之前添加where子句