+ 1

How to do SELECT * FROM table WHERE anycolumn LIKE '℅something℅' in SQL

19th Dec 2019, 6:42 PM
Kensy Master Will
Kensy Master Will - avatar
8 Respuestas
+ 1
For eg- there is an Employee table. SELECT * FROM Employee WHERE name LIKE "%a%"; This will fetch all details of the employees whose name contains the letter "a".
19th Dec 2019, 7:05 PM
Avinesh
Avinesh - avatar
0
If i don't want to specify witch column?
19th Dec 2019, 7:31 PM
Kensy Master Will
Kensy Master Will - avatar
0
Then there is no point of using LIKE because it is usually used with the WHERE clause and it means you have to specify a condition.
19th Dec 2019, 7:34 PM
Avinesh
Avinesh - avatar
0
I want select all rows from anycolumn that containt '℅some%'
19th Dec 2019, 7:42 PM
Kensy Master Will
Kensy Master Will - avatar
0
I want to filter any columns
19th Dec 2019, 7:52 PM
Kensy Master Will
Kensy Master Will - avatar
0
Kensy Master Will that is not possible the way you want it. You must apply LIKE to all columns, each separated by a OR condition.
19th Dec 2019, 7:58 PM
Avinesh
Avinesh - avatar
0
If i have 100 columns
19th Dec 2019, 8:01 PM
Kensy Master Will
Kensy Master Will - avatar
0
Yea I can see where you are heading with that but unfortunately I don't think you can do that. Still let us wait for more responses.
19th Dec 2019, 8:04 PM
Avinesh
Avinesh - avatar