Editor Raw Sql Use

Editor Raw Sql Use

omurltsomurlts Posts: 35Questions: 6Answers: 0

How im use raw sql code in editor

select mca.id,mca.data_id,mca.p_id,mca.durum,mccc.durum,mccc.iptal_neden,mccc.erteleme_tarih from mod_cagri_aramalistesi mca 
left join (select arama_id,max(id) as last_id from mod_cagri_cagrilistesi GROUP BY arama_id) mcc on  mca.id = mcc.arama_id
left join mod_cagri_cagrilistesi mccc on mcc.last_id = mccc.id

I'm having problems with translation editor.

Replies

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    Hi,

    Currently I'm afraid you can't do that. What you would need to do is create a VIEW and read the data from that.

    Allan

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    what VIEW any example have?

  • allanallan Posts: 63,457Questions: 1Answers: 10,465 Site admin

    Assuming you are using MySQL, the documentation for a VIEW is in the MySQL docs. It basically lets you create what appears to be a table externally, but can contain complex SQL statements.

    Allan

  • omurltsomurlts Posts: 35Questions: 6Answers: 0

    im fix this. maybe need other person

    Editor::inst($db, 'mod_cagri_aramalistesi', 'id')
      ->fields(
        Field::inst( 'mod_cagri_aramalistesi.id', 'mca.id'),
        Field::inst( 'mod_cagri_aramalistesi.o_tarih', 'mca.o_tarih'),
        Field::inst( 'mod_cagri_aramalistesi.p_id', 'mca.p_id'),
        Field::inst( 'mod_cagri_aramalistesi.data_id', 'mca.data_id'),
        Field::inst( 'mod_cagri_aramalistesi.durum', 'mca.durum'),
        Field::inst( 'mod_cagri_aramalistesi.filitre_tarih', 'mca.filitre_tarih'),
        Field::inst( 'mod_cagri_aramalistesi.filitre_list', 'mca.filitre_list'),
        Field::inst( 'mod_datalistesi.firma','md.firma' ),
        Field::inst( 'mod_datalistesi.telefon','md.telefon' ),
        Field::inst( 'mod_datalistesi.web','md.web' ),
        Field::inst( 'mccc.iptal_neden')
    
      )
      ->leftJoin('mod_datalistesi','mod_datalistesi.id','=','mod_cagri_aramalistesi.data_id' )
      ->leftJoin('(select arama_id,max(id) as last_id from mod_cagri_cagrilistesi GROUP BY arama_id) as mcc','mod_cagri_aramalistesi.id','=','mcc.arama_id')
      ->leftJoin('mod_cagri_cagrilistesi as mccc','mcc.last_id','=', 'mccc.id')
      ->where(function($q) use ($p_id){
        //$q->where( 'mod_cagri_aramalistesi.p_id',$p_id);
        //$q->where( 'mod_cagri_aramalistesi.durum', '(0,3)', 'IN', false );
      })
      ->debug(true)
      ->process($_POST)
      ->json();
    
This discussion has been closed.