Sample Header Ad - 728x90

Find if any of the rows partially match a string

13 votes
4 answers
69178 views
I want to see if a table contains any sub-string of a given string. Let's say I have a string somedomain.com In database I have: blabladomain.com testdomain.com domain.com I need to make a query that will return "domain.com" as it is a substring of "somedomain.com". I don't know if this is even possible in MySQL. CREATE TABLE site_core_antispam_banned_domain ( domain_id int(11) NOT NULL AUTO_INCREMENT, domain_name varchar(255) NOT NULL, PRIMARY KEY (domain_id) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
Asked by Emanuel (263 rep)
Apr 6, 2018, 05:45 AM
Last activity: Jun 7, 2023, 09:01 AM