How combine 3 tables

How combine 3 tables

omurltsomurlts Posts: 35Questions: 6Answers: 0
Table: data 
-------------------
| id | name       | 
-------------------
| 1  | Allan      |
| 2  | Charlie    |
| 3  | Fiona      |
| 4  | Richard    |
-------------------


Table: call 
-------------------
| id | data_id    | 
-------------------
| 1  | 4          |
| 2  | 1          |
| 3  | 2          |
| 4  | 3          |
-------------------

Table: call_detay 
-----------------------------------------
| id | call_id    |  phone | not        | 
-----------------------------------------
| 1  | 1          | 111    | detay 1    |
| 2  | 1          | 112    | detay 2    |
| 3  | 1          | 113    | detay 3    |
| 4  | 4          | 111    | detay 1    |
-----------------------------------------

im use editor php libraries. I want to combine 3 tables

for example :
data.id = call.data_id
call.id = call_detay.call_id <--- but there im want last insert (call_detay id 3 )

how im make this datatables library ?

pls give me example code.

Answers

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    Use left join to join the tables
    https://editor.datatables.net/manual/php/joins

    and a where condition to filter records
    https://editor.datatables.net/manual/php/conditions

    To understand how this works you would need to have some understanding of relational databases and SQL. If you don't I would start with this:
    https://www.w3schools.com/sql/

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    just need simple example !!

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    There are a couple of simple examples here.
    https://editor.datatables.net/examples/index

    It doesn't matter if you left join one or a dozen tables. It is always the same!

    If that doesn't help you then you'll find a complex example here. It has multiple left joins, some of them are turned into implicit inner joins by checking for NOT NULL in the where clause. Some of the tables left joined aren't even tables but mySql views. You can do whatever you like. This isn't the limit. But one thing is clear: You must understand relational databases and relational data modelling. If you don't you'll be lost.

    function tblInfomaContractData(&$db, &$lang) {        
        if ($lang === 'de') {     
            $msg[0] = 'Feld darf nicht leer sein.';
            $msg[1] = 'Bitte geben Sie eine Zahl ein.';
            $msg[2] = 'Bitte geben Sie mindestens ein Aufwands- / Ertragskonto ein.';
            $msg[3] = 'Bitte geben Sie mindestens ein Aufwands- / Ertragsabgrenzungskonto ein.';
            $msg[4] = 'Bitte geben Sie mindestens ein Kreditoren- / Debitoren-Konto ein.';
            $msg[5] = 'Bitte geben Sie mindestens ein Verbindlichkeiten- / Vermögensgegenstände-Konto ein.';
        } else {
            $msg[0] = 'Field may not be empty.';
            $msg[1] = 'Please enter a number.';
            $msg[2] = 'Please enter at least one Expense / Income Account #.';
            $msg[3] = 'Please enter at least one Expense / Income Accrual Account #.';
            $msg[4] = 'Please enter at least one Creditor / Debtor Account #.';
            $msg[5] = 'Please enter at least one Liability / Asset Account #.';
        }
        Editor::inst( $db, 'contract' )
        ->field(
            Field::inst( 'contract.id' )->set( false ),
            Field::inst( 'contract.creditor_id' )->set( false ),
            Field::inst( 'creditor.name' )->set( false ),
            Field::inst( 'creditor.city' )->set( false ),
            Field::inst( 'gov_manual_creditor.name' )->set( false ),
            Field::inst( 'govdept.name' )->set( false ),
            Field::inst( 'govdept.muni_number' )->set( false ),
            Field::inst( 'gov.regional_12' )->set( false ),
            Field::inst( 'contract.is_manual_draft' )->set( false ),
            Field::inst( 'contract.counterparty' )->set( false ),
            Field::inst( 'contract.instrument' )->set( false ),
            Field::inst( 'contract.type' )->set( false ),
            Field::inst( 'contract.derivative' )->set( false ),
            Field::inst( 'contract.start_date' )->set( false )
                ->getFormatter( function ( $val, $data, $opts ) {
                            return getFormatterDate($val);                 
                } ),
            Field::inst( 'contract.number' )->set( false ),   
            Field::inst( 'contract.serial' )->set( false ),
            Field::inst( 'contract.label' )->set( false ),
            Field::inst( 'contract.purpose' )->set( false ),
            Field::inst( 'contract.update_time' )->set( false ),
            Field::inst( 'contract_has_infoma.contract_id' )->set ( false ),
            Field::inst( 'contract_has_infoma.include' ),
            Field::inst( 'contract_has_infoma.external_id' )
                ->validator( function ( $val, $data, $opts ) use ( $msg ) {
                    if ( $data['contract_has_infoma']['include'] > 0 && isset($val) ) {
                        if ($val <= '') {
                            return $msg[0];
                        }
                    }
                    return true;
                } ),
            Field::inst( 'contract_has_infoma.cred_acct_number' )
                ->validator( function ( $val, $data, $opts ) use ( $msg ) {
                    if ( $data['contract_has_infoma']['include'] > 0 && isset($val) ) {
                        if ( $data['contract_has_infoma']['debt_acct_number'] <= ''
                             && $val <= ''                                          ) {
                            return $msg[4];    
                        }
                    }
                    return true;
                } ),
            Field::inst( 'contract_has_infoma.debt_acct_number' )
                ->validator( function ( $val, $data, $opts ) use ( $msg ) {
                    if ( $data['contract_has_infoma']['include'] > 0 && isset($val) ) {
                        if ( $data['contract_has_infoma']['cred_acct_number'] <= ''
                             && $val <= ''                                          ) {
                            return $msg[4];    
                        }
                    }
                    return true;
                } ),
            
            Field::inst( 'contract_has_infoma.netting' )
                ->setFormatter( function($val, $data, $opts) {
                    if ( isset($data['contract']['derivative']) ) {
                        if ( $data['contract']['derivative']  === 'X2'  ||
                             $data['contract']['derivative']  === 'Y5'      ) {
                            return $val;
                        }
                    }
                    return 0; //no netting for others    
                }),
            Field::inst( 'contract_has_infoma.cost_center' )
                ->validator( function ( $val, $data, $opts ) use ( $msg ) {
                    if ( $data['contract_has_infoma']['include'] > 0 && isset($val) ) {
                        if ($val <= '') {
                            return $msg[0];
                        }
                    }
                    return true;
                } ),
            Field::inst( 'contract_has_infoma.funder' )
                ->validator( function ( $val, $data, $opts ) use ( $msg ) {
                    if ( $data['contract_has_infoma']['include'] > 0 && isset($val) ) {
                        if ($val <= '') {
                            return $msg[0];
                        }
                    }
                    return true;
                } ),
            Field::inst( 'contract_has_infoma.payment_method' ),
            Field::inst( 'contract_has_infoma.account_owner' ),
            Field::inst( 'contract_has_infoma.BIC' ),
            Field::inst( 'contract_has_infoma.IBAN' )
                ->validator( function ( $val, $data, $opts ) {
                    return validatorIban($val);
                })
                ->getFormatter( function($val, $data, $opts) {
                    return getFormatterIban($val);
                })
                ->setFormatter( function($val, $data, $opts) {
                    return setFormatterIban($val);
                }),    
            Field::inst( 'contract_has_infoma.short_cut_3' ),
            Field::inst( 'contract_has_infoma.short_cut_4' ),
            Field::inst( 'contract_has_infoma.short_cut_5' ),
            Field::inst( 'contract_has_infoma.short_cut_6' ),
            Field::inst( 'contract_has_infoma.short_cut_7' ),
            Field::inst( 'contract_has_infoma.short_cut_8' ),
            Field::inst( 'contract_has_infoma.update_time' )->set(Field::SET_BOTH)
                                                 ->setValue( mySqlTimestamp() ),
            Field::inst( 'contract_has_infoma.updater_id' )->set(Field::SET_BOTH)
                                                ->setValue( $_SESSION['id'] ),
            Field::inst( 'contract_has_infoma.creator_id' )->set(Field::SET_CREATE)
                                                ->setValue( $_SESSION['id'] )       
        )
        ->leftJoin( 'contract_has_infoma', 'contract.id', '=', 'contract_has_infoma.contract_id')        
        ->leftJoin( 'creditor', 'contract.creditor_id', '=', 'creditor.id')
        ->leftJoin( 'gov_manual_creditor', 'contract.gov_manual_creditor_id', '=', 'gov_manual_creditor.id')        
        ->leftJoin( 'govdept', 'contract.govdept_id', '=', 'govdept.id' )
        ->leftJoin( 'govdept_has_infoma', 'govdept.id', '=', 'govdept_has_infoma.govdept_id' )
        ->leftJoin( 'infoma_has_user', 'govdept_has_infoma.infoma_id', '=', 'infoma_has_user.infoma_id' )        
        ->leftJoin( 'gov', 'govdept.gov_id', '=', 'gov.id' )
        ->where( function ( $q ) {        
            //users can only see infoma installations with departments for which they have
            //at least editing rights
            //view: infoma_has_user (includes LGF users as well)
            $q  ->where( 'infoma_has_user.user_id', $_SESSION['id'] );
            $q  ->where( 'govdept.accounting_interface', 'Infoma');
            $q  ->where( 'govdept.id', null, '!=' );
            $q  ->where( 'govdept_has_infoma.govdept_id', null, '!=' );
            $q  ->where( 'infoma_has_user.infoma_id', null, '!=' );
            $q  ->where( function ( $r ) {  //only non-expired or recently expired contracts
                $r ->where( 'contract.expired', 1, '<' );
                $r ->or_where( 'contract.exp_date', 'CURDATE() - INTERVAL 1 WEEK', '>', false );            
            } );  
        } )
        ->on('preEdit', function ( $editor, $id, $values ) {   
            //fields are not set in case we only edit the include field through the
            //table checkbox
            if ( ( ! isset($values['contract_has_infoma']['cred_acct_number']) ) &&
                 ( ! isset($values['contract_has_infoma']['debt_acct_number']) )    ) {
               $editor->field('contract_has_infoma.external_id')->set( false );
               $editor->field('contract_has_infoma.cred_acct_number')->set( false );
            }
        })
        ->on( 'postCreate', function ( $editor, $id, $values, $row ) {            
            logChange( $editor->db(), 'create', $id, $row, 'contract_has_infoma' );
        } )
        ->on( 'postEdit', function ( $editor, $id, $values, $row ) {
            logChange( $editor->db(), 'edit', $id, $row, 'contract_has_infoma' );
        } )
        ->on( 'postRemove', function ( $editor, $id, $values ) {
            logChange( $editor->db(), 'delete', $id, $values, 'contract_has_infoma' );
        } )
        ->debug(true)
        ->process($_POST)            
        ->json();
    }
    

    Here is another posts on inner joins with Editor. Might be relevant to understand the above code.

    https://datatables.net/forums/discussion/49891

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414
    edited September 2018

    Alternative approach:
    Just post a tested SQL SELECT statement of what you want to achieve. (select will do, no need to provide insert, update and delete statements.) If you provide that anyone with Editor PHP experience should be able to convert it into Editor PHP Syntax.

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    edited September 2018
        Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
          ->fields(
            Field::inst( 'mod_cagri_aramalistesi.id' ),
            Field::inst( 'mod_cagri_aramalistesi.p_id' ),
            Field::inst( 'mod_cagri_aramalistesi.durum' )
          )
          ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
          ->join(
            MJoin::inst('mod_cagri_cagrilistesi')
              ->link('mod_cagri_aramalistesi.id','mod_cagri_cagrilistesi.arama_id')
              ->fields(
                Field::inst('id'),
                Field::inst('firma'),
                Field::inst('durum')
              )
          )
          ->debug(true)
          ->process($_POST)
          ->json();
    

    my json

    "data": [
        {
          "DT_RowId": "row_2",
          "mod_cagri_aramalistesi": {
            "id": "2",
            "p_id": "6",
            "durum": "2"
          },
          "mod_cagri_cagrilistesi": [
            {
              "id": "1",
              "firma": "ABC ABC",
              "durum": "3"
            },
            {
              "id": "220",
              "firma": "ABC ABC",
              "durum": "2"
            }
          ]
        },
    

    im just want

    mod_cagri_cagrilistesi.durum == mod_cagri_aramalistesi.durum

    not want show other

    want this json

    "data": [
            {
              "DT_RowId": "row_2",
              "mod_cagri_aramalistesi": {
                "id": "2",
                "p_id": "6",
                "durum": "2"
              },
              "mod_cagri_cagrilistesi": [
                {
                  "id": "220",
                  "firma": "ABC ABC",
                  "durum": "2"
                }
              ]
            },
    

    im try im combination im tried pls help this about

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    You need to use a where clause. You already have the link from me above. I am not going to write your code. Sorry.

    https://editor.datatables.net/manual/php/conditions

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    bro im just need help im not full write code

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' )
      )
      ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
      ->join(
        MJoin::inst('mod_cagri_cagrilistesi')
          ->link('mod_cagri_aramalistesi.id','mod_cagri_cagrilistesi.arama_id')
          ->fields(
            Field::inst('id'),
            Field::inst('firma'),
            Field::inst('durum')
          )
        ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=')
      )
      ->debug(true)
      ->process($_POST)
      ->json();
    

    im where clasuse added but still not working.

    I just want to know where I made the mistake.

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    As far as I can tell your where clause is in the wrong place. I don't understand why you need the mjoin. Why don't you write your statement in plain SQL and test it? Once you have the SQL working I can take a look and show you how to convert it into Editor PHP syntax.

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    edited September 2018

    @rf1234 bro thanks you
    pls dont help me

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    edited September 2018

    select * from mod_cagri_aramalistesi mca left join mod_cagri_cagrilistesi mcc on mca.id = mcc.arama_id where mca.p_id = 5 and mca.durum = mcc.durum

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    And this should be the Editor PHP code:

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' ),
        Field::inst( 'mod_cagri_cagrilistesi.id' ),
        Field::inst( 'mod_cagri_cagrilistesi.firma' ),
        Field::inst( 'mod_cagri_cagrilistesi.durum' )
      )
     ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
      ->where('mod_cagri_cagrilistesi.id' ,null, '!=')
      ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=')
      ->where('mod_cagri_aramalistesi.p_id', 5 )
      ->debug(true)
      ->process($_POST)
      ->json();
    

    Since you definitely want an inner join I would keep the checking for null values of the key of the dependent table.

    I think normally you won't want to have a hardcoded key value in your code like this:

    ->where('mod_cagri_aramalistesi.p_id', 5 )
    

    You could simply remove this line and it should still work.

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    im before write this code

    query": "SELECTmod_cagri_aramalistesi.idas 'mod_cagri_aramalistesi.id',mod_cagri_aramalistesi.p_idas 'mod_cagri_aramalistesi.p_id',mod_cagri_aramalistesi.durumas 'mod_cagri_aramalistesi.durum',mod_cagri_cagrilistesi.durumas 'mod_cagri_cagrilistesi.durum' FROMmod_cagri_aramalistesiLEFT JOINmod_cagri_cagrilistesiONmod_cagri_aramalistesi.id=mod_cagri_aramalistesi.arama_idWHEREmod_cagri_cagrilistesi.idIS NOT NULL ANDmod_cagri_aramalistesi.durum= :where_1 ANDmod_cagri_aramalistesi.p_id` = :where_2 ",

    give this error...

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    sorry but I have no idea what you mean and certainly there is no error message in your post. You can work with this code which seems to have been generated by Editor and test it in MySQLWorkbench or whatever you are using.

    You would need to find out what the bound values are :where_1 and :where_2. The debugger also returns this.

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    Try this:

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' ),
        Field::inst( 'mod_cagri_cagrilistesi.id' ),
        Field::inst( 'mod_cagri_cagrilistesi.firma' ),
        Field::inst( 'mod_cagri_cagrilistesi.durum' )
      )
     ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
      ->where('mod_cagri_cagrilistesi.id' ,null, '!=')
      ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=', false)
      ->where('mod_cagri_aramalistesi.p_id', 5 )
      ->debug(true)
      ->process($_POST)
      ->json();
    

    I added the "false" in the where clause on "durum" to avoid "mod_cagri_cagrilistesi.durum" being escaped as a string.

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    {
      "data": [
    
      ],
      "options": [
    
      ],
      "files": [
    
      ],
      "debug": [
        {
          "query": "SELECT  `mod_cagri_aramalistesi`.`id` as 'mod_cagri_aramalistesi.id', `mod_cagri_aramalistesi`.`p_id` as 'mod_cagri_aramalistesi.p_id', `mod_cagri_aramalistesi`.`durum` as 'mod_cagri_aramalistesi.durum', `mod_cagri_cagrilistesi`.`id` as 'mod_cagri_cagrilistesi.id', `mod_cagri_cagrilistesi`.`firma` as 'mod_cagri_cagrilistesi.firma', `mod_cagri_cagrilistesi`.`durum` as 'mod_cagri_cagrilistesi.durum' FROM  `mod_cagri_aramalistesi` LEFT JOIN `mod_cagri_cagrilistesi` ON `mod_cagri_aramalistesi`.`id` = `mod_cagri_cagrilistesi`.`arama_id` WHERE `mod_cagri_cagrilistesi`.`id` IS NOT NULL AND `mod_cagri_aramalistesi`.`durum` = :where_1 AND `mod_cagri_aramalistesi`.`p_id` = :where_2 ",
          "bindings": [
            {
              "name": ":where_1",
              "value": "mod_cagri_cagrilistesi.durum",
              "type": null
            },
            {
              "name": ":where_2",
              "value": 5,
              "type": null
            }
          ]
        }
      ]
    }
    

    this working.

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' ),
        Field::inst( 'mod_cagri_cagrilistesi.id' ),
        Field::inst( 'mod_cagri_cagrilistesi.firma' ),
        Field::inst( 'mod_cagri_cagrilistesi.durum' )
      )
      ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
      ->where('mod_cagri_aramalistesi.p_id','5')
      ->debug(true)
      ->process($_POST)
      ->json();
    

    this code not working.
    ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=', false)

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    when im added this

    ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=', false)

    {
          "DT_RowId": "row_4537",
          "mod_cagri_aramalistesi": {
            "id": "4537",
            "p_id": "5",
            "durum": "0"
          },
          "mod_cagri_cagrilistesi": {
            "id": null,
            "firma": null,
            "durum": null
          }
        },
    

    all mod_cagri_cagrilistesi field null coming.

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414
    edited September 2018

    Try this:

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' ),
        Field::inst( 'mod_cagri_cagrilistesi.id' ),
        Field::inst( 'mod_cagri_cagrilistesi.firma' ),
        Field::inst( 'mod_cagri_cagrilistesi.durum' )
      )
     ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
     ->where( function($q) {
         $q ->where('mod_cagri_cagrilistesi.id', null, '!=')
         $q ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=', false)
         $q ->where('mod_cagri_aramalistesi.p_id', 5 )
     })
      ->debug(true)
      ->process($_POST)
      ->json();
    

    Unfortunately you didn't post the content of the bound values as per my request above. Looking at this: AND mod_cagri_aramalistesi.durum = :where_1
    I assume that this still is being escaped as a string.

    Hence I took a look at the docs:
    https://editor.datatables.net/manual/php/conditions
    section "Complex Usage".

    Looks like this only works using an anonymous function. I am using it with an anonymous function in my code as well.

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    @rf1234 thanks you bro

    im tried im try different system.

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414
    edited September 2018

    Updated once again. Since I can't test this stuff with your code I forgot something. But this should now be executable PHP code:

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' ),
        Field::inst( 'mod_cagri_cagrilistesi.id' ),
        Field::inst( 'mod_cagri_cagrilistesi.firma' ),
        Field::inst( 'mod_cagri_cagrilistesi.durum' )
      )
     ->leftJoin('mod_cagri_cagrilistesi','mod_cagri_aramalistesi.id','=','mod_cagri_cagrilistesi.arama_id')
     ->where( function($q) {
         $q ->where('mod_cagri_cagrilistesi.id', null, '!=');
         $q ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=', false);
         $q ->where('mod_cagri_aramalistesi.p_id', 5 );
     })
     ->debug(true)
     ->process($_POST)
     ->json();
    
  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    yes this working thank you so much bro...

  • rf1234rf1234 Posts: 2,906Questions: 87Answers: 414

    ok! read the docs ... :sweat_smile:
    Greetings to Turkey!

  • omurltsomurlts Posts: 35Questions: 6Answers: 0
    edited September 2018

    I wanted to do exactly that

    Editor::inst( $db, 'mod_cagri_aramalistesi' , 'id' )
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id' ),
        Field::inst( 'mod_cagri_aramalistesi.p_id' ),
        Field::inst( 'mod_cagri_aramalistesi.durum' )
      )
      ->join(
        MJoin::inst('mod_cagri_cagrilistesi')
          ->link('mod_cagri_aramalistesi.id','mod_cagri_cagrilistesi.arama_id')
          ->fields(
            Field::inst('id'),
            Field::inst('firma'),
            Field::inst('durum')
          )
          ->where( function($q) {
            $q ->where('mod_cagri_aramalistesi.durum','mod_cagri_cagrilistesi.durum','=', false);
          })
      )
      ->debug(true)
      ->process($_POST)
      ->json();
    

    your example I completely solved my job

    again thank you very much @rf1234

This discussion has been closed.