I am having the same problem.
This Query:
SELECT 'haystack needle haystack' LIKE concat('%', 'needle', '%')
returns 1
However, this query does not work correctly If you generalize is to
include a database column:
SELECT * FROM MyTable WHERE 'haystack needle haystack' LIKE CONCAT('%',
On Sat, 29 Mar 2003 05:43:53 -0500, Jeff Moore wrote:
However, this query does not work correctly If you generalize is to
include a database column:
SELECT * FROM MyTable WHERE 'haystack needle haystack' LIKE CONCAT('%',
NeedleColumn, '%')
Two things:
1. you don't seem to need the CONCAT()
On Saturday, March 29, 2003, at 07:41 AM, Trevor Smith wrote:
2. your syntax just seems wrong. This should be:
SELECT * FROM MyTable WHERE NeedleColumn LIKE '%needle%';
to search for the string 'needle' anywhere in NeedleColumn, if that's
what you were looking for.
I'm jumping in mid-stream so
I wan't to search for all rows that match a value.
I have these rows:
URL Name
'http://www.microsoft.com/kb/' Microsoft Knowledgebase
'http://www.microsoft.com/search/' Microsoft Search
Now I wan't to find all occurences where any of above URL
I tried to use LIKE:
SELECT URL, Name
FROM websites
WHERE 'http://www.microsoft.com/kb/knowledgeb.asp?id=3strse=12'
LIKE (URL + '%');
But this doesn't return any results. I would like the following as output:
'http://www.microsoft.com/kb/'Microsoft Knowledgebase
Hi!
How about the
I thought you only could use the likesyntax like this;
SELECT column from table where column like '%data%';
i have a hard time seeing what goodit would be calling a column
http:// =)
check;
http://www.mysql.com/doc/en/Pattern_matching.html
regards
lasse
On Sun, 23 Mar 2003, Ville Mattila
The reason that what you are doing isn't working is because you are
trying to find a really long string in a short string. You need to
reverse your string searching.
Try:
SELECT URL, Name
FROM websites
WHERE LOCATE(URL,
'http://www.microsoft.com/kb/knowledgeb.asp?id=3strse=12') 0;
Here's
Thanks!
I know I'm searching for for a long string within a short string - but that's why I
reversed the expression from column LIKE(value) to value LIKE(column)
But I think I just might go for your solution using the LOCATE function as it seems to
better fit this specific need.
/Jakob