Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL: column <> '%TEST%' does not work, why?

Tags:

sql

I do not understand why following code does not work?

SELECT [column1], [column2]
FROM table where Column1 <> ('%TEST%')
ORDER BY 1

I want to have all rows where Column1 does not contain TEST

Thanks

like image 489
Petr Avatar asked Dec 04 '22 12:12

Petr


1 Answers

Use LIKE operator with Wildcards %:

SELECT [column1], [column2] 
FROM table 
WHERE Column1 NOT LIKE ('%TEST%') 
ORDER BY 1
like image 86
systempuntoout Avatar answered Dec 11 '22 16:12

systempuntoout