sql >> Base de Datos >  >> RDS >> Mysql

Una consulta sql única general

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

Solución 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' )";