11

I have a database that is supposed to contain all top-level and second-level domain names. But the feed I'm parsing contains a lot of sub folders, I'd like to delete any row that contains any % sign in it, but I am having a hard time figuring out how to use a percent sign as the field I'd like to match, while still using the LIKE feature. Below is the code I'm trying to use:

select FROM `001ProductList` WHERE programURL  LIKE '%%%'

Here is an example of what I'm trying to match:

www.site.com%3Ack-5941560-10463497?url=http%3A%2F%2Fwww.example.com%2Fproddetail.aspx%...

If I encounter a row with a % sign in it, I want to delete it.

4

2 回答 2

24

转义文字%字符:

select * 
FROM 001ProductList
WHERE programURL LIKE '%\%%'

或使用正则表达式

WHERE programURL RLIKE '%'
于 2013-11-03T04:23:45.437 回答
3

您可以使用该LOCATE功能,如下所示:

SELECT * 
FROM `001ProductList`
WHERE LOCATE('%', `programURL`) <> 0;
于 2013-11-03T04:41:46.670 回答