I search for a way to find a part of a given string in my table entries. The field is varchar in table.
Search for
/brands/brand/actona/kitchen-article/item/01945
and want to find this row:
/brands/brand/actona/$
- or maybe this row
/brands/brand/actona/kitchen-$
Is there a way to solve this issue? The problem is that the table have at least 57k entries. I import the data from a old (too large) nginx-config file which are all permanent redirects.
Updated: What I need a roughly the opposite of "LIKE", because just a part of the string i search for is stored in table with a wildcard ($), that can match also another string that starts with the same. /brands/brand/actona/$
can match /brands/brand/actona/123
but also /brands/brand/actona/abc/def
.
So when I search for /brands/brand/actona/abc/def
or even /brands/brand/actona/abc/def/xyz
it need to match the row /brands/brand/actona/$
I actually try to outsource 57k permanent redirects from a nginx.config file to avoid checking a 6MB config file on each request.
I'm so sorry for my terrible english :(
Perhaps something like
SELECT * FROM TABLE
WHERE '/brands/brand/actona/kitchen-article/item/01945'
LIKE CONCAT('%', URLCOLUMN, '%');
How about something like this?
SELECT * FROM table
WHERE
column REGEXP '(/[a-zA-Z0-9-]+)+\$?'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.