Reputation: 59
example:
SELECT country
FROM data
WHERE city LIKE
(SELECT LEFT ('jakartada',7));
it's working nicely but if i give delimiter with value:4 ,i must give wildcard like this ---> "%string%" ,where i can give wildcard in the query?
Upvotes: 0
Views: 2686
Reputation: 99
why you using sub query?
SELECT * FROM `data` WHERE city LIKE 'jakar%'
Upvotes: 0
Reputation: 3716
With LIKE you can use the following two wildcard characters in the pattern.
Character Description
% Matches any number of characters, even zero characters
_ Matches exactly one character
\% Matches one “%” character
\_ Matches one “_” character
does this query help you?
SELECT country
FROM data
WHERE city LIKE CONCAT ('%', (SELECT LEFT ('jakartada',7)), '%');
Upvotes: 4