SQL more elegant combination of boolean checks possible?

Posted by Matze on Stack Overflow See other posts from Stack Overflow or by Matze
Published on 2013-10-17T13:39:21Z Indexed on 2013/10/17 15:56 UTC
Read the original article Hit count: 104

Filed under:
|

Call me pedantic but is there a more elegant way to combine all those checks?

SELECT * FROM [TABLE1] 
WHERE [path] = 'RECEIVE' 
AND [src_ip] NOT LIKE '10.48.20.10' 
AND [src_ip] NOT LIKE '0.%' 
AND [src_ip] NOT LIKE '127.%' 
ORDER BY [date],[time] DESC; 

To something like this:

SELECT * FROM [TABLE1] 
WHERE [path] = 'RECEIVE' 
AND [src_ip] NOT LIKE IN ('10.48.20.10','0.%','127.%', .... ) 
ORDER BY [date],[time] DESC; 

© Stack Overflow or respective owner

Related posts about sql

Related posts about combine