过滤出两列等于一件事的行

时间:2018-08-02 15:11:30

标签: php mysql sql laravel

我有以下查询。我希望它过滤掉类型和关系都等于“ communicator”的联接后的行。我尝试了whereRaw('(type <> communicator and relationship <> communicator'),但收到一个令人讨厌的错误消息。如何获得想要的结果?

关系在titles_to_communicators中,类型在communicators中。

$query = \DB::table('titles_to_communicators')
    ->leftJoin('communicators', 'communicators.id', '=', 'titles_to_communicators.communicator_id')
    ->where('relationship', '<>', 'character')
    ->whereIn('title_id', $childIds)
    ->groupBy('communicators.slug')
    ->limit(40);

1 个答案:

答案 0 :(得分:1)

尝试

  

其中(类型=“沟通者”和关系=“沟通者”)

相关问题