Mysql
 sql >> Base de données >  >> RDS >> Mysql

Une requête SQL unique générale

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

Solution complète :

$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' )";