Reputation:
how to combine sql query from three like statements? I`m trying like this:
SELECT * FROM myTable
WHERE
(NAME LIKE '%someChars%' AND
(CITY LIKE '%someChars%' AND
TYPE LIKE'% someChars%')
);
It doesn`t work, can you help me with that please ?
Upvotes: 0
Views: 132
Reputation: 1881
The query is correct except the fact that Type
is a sql keyword, so try putting it between bracket like that:
SELECT * FROM [myTable]
WHERE ([NAME] LIKE '%someChars%' AND
([CITY] LIKE '%someChars%' AND
[TYPE] LIKE '%someChars%'));
PS: The parenthesis are not needed
Upvotes: 1
Reputation: 1561
SELECT *
FROM myTable
WHERE
NAME LIKE '%someChars%' AND
CITY LIKE '%someChars%' AND
TYPE LIKE '%someChars%';
Upvotes: 0