Select with two conditions

0

How do I select users who have code other than 0 and 573?

For example, this is my table:

 Usuario Codigo
    1        573
    2        0
    3        0
    4        100
    5        520

I need to select only users who have DIFFERENT code 0 and 573.

    
asked by anonymous 27.12.2018 / 12:28

2 answers

2

You have two alternatives to do this:

SELECT  * 
FROM    MinhaTabela 
WHERE   Codigo <> 0 
    AND Codigo <> 573

Or:

SELECT  * 
FROM    MinhaTabela 
WHERE   Codigo NOT IN (0, 573)
    
27.12.2018 / 13:16
1
SELECT * FROM TABELA WHERE CODIGO <> 0 AND CODIGO <> 573
    
27.12.2018 / 12:31