Re: Using LIKE to search for occurence of a column value in a string

2003-03-29 Thread Jeff Moore
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

Re: Using LIKE to search for occurence of a column value in a string

2003-03-29 Thread Trevor Smith
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

Re: Using LIKE to search for occurence of a column value in a string

2003-03-29 Thread Jeff Moore
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('%', NeedleC

RE: Using LIKE to search for occurence of a column value in a string

2003-03-23 Thread Jakob Vedel Adeltoft
it this specific need. /Jakob > -Original Message- > From: Jeff Shapiro [mailto:[EMAIL PROTECTED] > Sent: Sunday, March 23, 2003 7:46 PM > To: [EMAIL PROTECTED] > Subject: RE: Using LIKE to search for occurence of a column value in a > string > > > The reason

RE: Using LIKE to search for occurence of a column value in a string

2003-03-23 Thread Jeff Shapiro
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=3&strse=12') > 0; Here's s

RE: Using LIKE to search for occurence of a column value in a string

2003-03-23 Thread lasse
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 wr

RE: Using LIKE to search for occurence of a column value in a string

2003-03-23 Thread Ville Mattila
> I tried to use LIKE: > SELECT URL, Name > FROM websites > WHERE 'http://www.microsoft.com/kb/knowledgeb.asp?id=3&strse=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 a

Using LIKE to search for occurence of a column value in a string

2003-03-23 Thread Jakob Vedel Adeltoft
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 col