Make query not showing some results

3

I have a CPF table where the CPF's are registered. I need to make a SELECT where I display all the registered CPF's, minus 3 CPF's.

Something like:

 SELECT * 
   FROM cpf 
  WHERE cpf_id <> '111.111.111.11,222.222.222.22,333.333.333.33';

What is the right way to do this type of query?

    
asked by anonymous 20.01.2016 / 13:38

1 answer

5

Use NOT IN () .

SELECT * 
  FROM cpf 
 WHERE cpf_id NOT IN ( '111.111.111.11'
                      ,'222.222.222.22'
                      ,'333.333.333.33');
    
20.01.2016 / 13:41