I've been trying to figure this out, but no success yet. I have two tables, each one with a single varchar column:
Table 1: srch(word varchar)
Table 2: tags (tag varchar)
The values in each table are:
srch: "joining", "tables", "snakes"
tags: "join", "table", "group"
What I'm trying to achieve is get the words from search (srch) table that don't match with tags table, however a need to do it using wildcard. So, when I do it with LIKE, it works alright:
select s.word from srch s, tags t where s.word like concat(t.tag,"%") group by s.word
I need to get the words that don't match with tags table, in this case the word 'snake', so, if I try with NOT LIKE
it doesn't work:
select s.word from srch s, tags t where s.word not like concat(t.tag,"%") group by s.word
With this sentence, it returns all the values from srch table.
EDIT: Sample code:
CREATE TABLE `srch` (
`word` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `srch` VALUES ('joining'),('tables'),('snakes');
CREATE TABLE `tags` (
`tag` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `tags` VALUES ('join'),('table'),('group');
Any hint for this query? Thank you.