Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

return all results in mysql/sql using format where equals wildcard

how do I put together an sql that will return ALL values with a wild card example:

WHERE fieldname = 'ALL'

I tried the wild card % and the * and none of them worked. I know I can do a query that returns all values but this is for a search filter and I need to have that option to use it in that format and the format is :

WHERE fieldname ='all';

or

maybe WHERE fieldname ='%';

the latter didn't work btw. any suggestions please

like image 789
cppit Avatar asked Dec 04 '25 13:12

cppit


1 Answers

Write condition as: for finding string all.

WHERE fieldname like '%all%'; 

for finding any string

 WHERE fieldname like '%'; 
like image 149
Somnath Muluk Avatar answered Dec 07 '25 01:12

Somnath Muluk