Editor and join

Editor and join

yurispyyurispy Posts: 29Questions: 6Answers: 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

Replies

  • rf1234rf1234 Posts: 2,990Questions: 87Answers: 421
    edited March 2020

    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.

    https://datatables.net/forums/discussion/comment/132045/#Comment_132045

    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, '!=' );
    });
    
This discussion has been closed.