select rows that column value is bigger or smaller than another column

select rows that column value is bigger or smaller than another column

saee2838saee2838 Posts: 18Questions: 6Answers: 0

hi dear
i want filter rows show in table from database
code i want in mysql like that
SELECT * FROM 1399_09_26 WHERE co_buy_count>0 AND co_buy_count<6 AND co_sell_volume>(trade_volume0.7) AND real_buy_volume>(trade_volume0.7)

code that i write in datatables is
Editor::inst( $db, $date )
->field(
Field::inst( $date.'.full_name' )
->options( Options::inst()
->table( 'bazar' )
->value( 'full_name' )
->label( array('type ', 'market', 'sub_type') )
->render( function ( $row ) {
$sr=$row['type'].' '.$row['market'];
return $sr;
} )
)
->validator( 'Validate::dbValues' ),
Field::inst( 'bazar.type' ),
Field::inst( 'bazar.market' ),
Field::inst( 'bazar.sub_type' ),
Field::inst( $date.'.name' ),
Field::inst( $date.'.miangin_kharid_haghighi' ),
Field::inst( $date.'.miangin_forosh_haghighi' ),
Field::inst( $date.'.ghodrat_kharidar_haghighi' ),
Field::inst( $date.'.ghodrat_kharidar_hoghoghi' ),
Field::inst( $date.'.miangin_kharid_hoghoghi'),
Field::inst( $date.'.miangin_forosh_hoghoghi' ),
Field::inst( $date.'.final_price_change_percent' ),
Field::inst( $date.'.trade_volume' ),
Field::inst( $date.'.miangin_hajm_23' ),
Field::inst( $date.'.nesbat_hajm_23' ),
Field::inst( $date.'.nesbat_mabna' ),
Field::inst( $date.'.nesbat_kol' ),
Field::inst( $date.'.gheymat_sahm' ),
Field::inst( $date.'.ekhtelaf_gheymat' ),
Field::inst( $date.'.motevali_pc' ),
Field::inst( $date.'.motevali_haghighi' ),
Field::inst( $date.'.motevali_hoghoghi' ),
Field::inst( $date.'.rsi' )
)
->leftJoin( 'bazar', 'bazar.name', '=', $date.'.name' )
->where( $date.'.co_buy_count', 0, '>' )
->where( $date.'.co_buy_count', 5, '<=' )
->where( $date.'.co_sell_volume', ($date.'.trade_volume'0.7), '>' )
->where( $date.'.real_buy_volume', ($date.'.trade_volume'
0.7), '>' )
->process($_POST)
->json();

but that not show true result that i want

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    SELECT * FROM 1399_09_26 WHERE co_buy_count>0 AND co_buy_count<6 AND co_sell_volume>(trade_volume0.7) AND real_buy_volume>(trade_volume0.7)

    Use and_where() for your AND clauses.

This discussion has been closed.