hasandev
8 months ago
349
3
Laravel

Laravel join multiple tables with condition

Posted 8 months ago by hasandev

Hi, I am trying to achieve this query. But the second join has issue. Can you guys help to figure it out the issue?

$all_update = DB::table('posts as p')
      ->join('cprefs as c','p.qatype', '=', 'c.qatype')
      ->where('c.wwide', '=', 'p.wwide') //second join condition
      ->where('c.user_id', $u_id)
      ->where('p.arank', 1)
      ->get();

Please sign in or create an account to participate in this conversation.