SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: opposite of LIKE "%foo%"
-
Apr 8, 2008, 15:23 #1
- Join Date
- May 2007
- Posts
- 109
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
opposite of LIKE "%foo%"
Hi,
SELECT * FROM table WHERE foo LIKE "%barbarbar%"
will contain rows where foo contains "barbarbar"
=> for example where foo is "barbarbarbarbar"
What I want, are the rows where "barbarbar" contains foo
=> for example where foo is "barbar"
how to do it?
Greetings, Andreas
-
Apr 8, 2008, 16:42 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
-
Apr 8, 2008, 16:49 #3
- Join Date
- May 2007
- Posts
- 109
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi,
foo is always the coloumn in this example.
I think I found an possible solution:
SELECT * FROM table WHERE "barbarbar" LIKE CONCAT('%' , foo , '%')
Greetings, Andreas
Bookmarks