MySQL获取行,这些行不包含特定的字符串/单词

I want a MySQL query to return rows which don't have the only input string/phrase in it.

Example: I have table with the column name like

Sno  | sname
---------------
1    | AAA
2    | SSS
3    | Group Post
4    | Group Post, Test Run
5    | Group Post, Group Post
6    | Group Post, Group Post, My test Run

In the above table I want to eliminate the rows which have "Group Post" only in them. That means how many times Group Post exist in the row and there are no other phrases or words in them, then we can eliminate it.

So I want a query which will return

Sno  | sname
---------------
1    | AAA
2    | SSS
4    | Group Post, Test Run
6    | Group Post, Group Post, My test Run

In these rows some of them have Group Post in them. But along with the that we have other phrases in them.

Thanks in Advance.

You need REPLACE function to filter the data.

Try this:

select * from my_table
 where length( replace( replace( sname, 'Group Post', '' ), ', ', '' ) ) > 0

Refer to:
MySQL: REPLACE(str,from_str,to_str) Function

try a subquery for finding all the ids which have the string and then use not in for example

SELECT * FORM {table_name} where id not in (select * from {table_name} where sname = "YOUR_STRING");

select Sno,sname from table_name where length(replace(sname,'Group Post','')) > 0;

QUERY

SELECT *
FROM test
WHERE sname NOT LIKE '%Group Post'

SQL FIDDLE DEMO

hope this will help you...!