php How to join subquery ? is possible like query builder??

php How to join subquery ? is possible like query builder??

casuistcasuist Posts: 34Questions: 14Answers: 0
edited May 2017 in DataTables 1.10

I want to join subquery.

How??

Editor::inst( $db, 'user_info' )
    ->fields(
        Field::inst( 'user_id' ),
                ...
    )
    ->leftJoin( 'club_info',     'club_info.club_id',          '=', 'user_info.club_id' )
    

/* i want to join below subquery.
-------------------------------------------------
    select u.user_id u_id, sum(if(b.banking_type = 'I' and b.stat = 'E',b.amount,0)) AS `deposit_money_all`, sum(if(b.banking_type = 'O' and b.stat = 'E',b.amount,0)) AS `withdraw_money_all` from user_info u left outer join `banking` b on u.user_id = b.user_id where date(b.u_time) >= date('" . $sdate . "') and  date(b.u_time) <= date('" . $edate . "')   group by u.user_id as b on user_info.user_id = b.u_id 
----------------------------------------------------
*/  
        ->leftJoin( 'partner_info',     'partner_info.club_id',          '=', 'user_info.club_id' )
    ->leftJoin( 'view_banking_sum', 'user_id',          '=', 'view_banking_sum.user_id' )   
    ->leftJoin( 'view_order_sum', 'user_id',          '=', 'view_order_sum.user_id' )   

    ->where( 'date(banking.r_time)',date('Y-m-d',strtotime(date('Y-m-d').'-7 days')), '>')  

    ->process( $_POST );
        ->json();

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    I'm sorry to say that this is not something that the Editor PHP libraries currently support. The only way to address it would be to create a VIEW which you can then query.

    Allan

This discussion has been closed.