Editor and join

Editor and join

yurispyyurispy Posts: 21Questions: 5Answers: 0

In my script I can't use a left join.
because the table on the left is much too large compared to the called table.
Left table: 13976 records
main table: 184 records
What I need is an inner joint, but I don't know how to put it in place...

Someone might be able to give me some leads.
Thank you


  • rf1234rf1234 Posts: 1,567Questions: 51Answers: 215
    edited March 16

    You can use a left join and check the key of the joined table to be "NOT NULL" (or one of the key components of a link table). That is the same as an inner join.


    In this example I need to make sure the rfp is approved. This requires an inner join not a left join:

    ->leftJoin( 'rfp_has_govdept_approval', 'rfp.id', '=', 'rfp_has_govdept_approval.rfp_id')    
    //rfp is approved (where clause needed due to left join!)
    $q ->where(function ($r) {
        $r ->where( 'rfp_has_govdept_approval.rfp_id', null, '!=' );
Sign In or Register to comment.