Reputation: 2173
I want search articles with:
SELECT *
FROM articles
WHERE `body` LIKE `%src="http://%"
But I want except:
src="//example.com"
src="//media.example.com"
I try this:
SELECT *
FROM `articles`
WHERE `body` LIKE '%src="http://%' AND
`body` NOT LIKE '%src="http://example.com%' AND
`date_show` >= '2018-06-24'
LIMIT 20
But I get wrong results. How I can do this correctly?
Upvotes: 1
Views: 522
Reputation: 630
SELECT * FROM `articles` WHERE `body` LIKE '%src="http://%'
and `body` not in (SELECT body
FROM `articles` where `body` NOT LIKE '%src="http://example.com%' ) AND
`date_show` >= '2018-06-24' LIMIT 20;
Upvotes: 2