Mysql
 sql >> Database >  >> RDS >> Mysql

Una query sql singola generale

select * from dummy where concat_ws (',', id, roll_no) not in ('1,111', '2,222')

Soluzione completa:

$tableName = "test"; 
$fields = array( "id" , "roll_no" );
$values = array( "1,111", "2,222" );

$fieldsStr = implode(',', $fields);
$valuesStr = implode("','", $values);
$sql = "SELECT * 
    FROM $tableName 
    WHERE concat_ws(',', $fieldsStr ) NOT IN ( '$valuesStr' )";