Anand Deshmukh
Anand Deshmukh

Reputation: 11

Select all record from table except some record from the same table

I want to retrieve all the records from mem_info except the records whose username is 'qq';

following is my query

select * from mem_info where hashtag like '%love%' 
EXCEPT select * from mem_info where username='qq'; 

Thanks in advance.

Upvotes: 1

Views: 699

Answers (3)

Ullas
Ullas

Reputation: 11556

Query

SELECT * FROM mem_info 
WHERE hashtag LIKE '%love%' 
AND username NOT IN ('qq');

Upvotes: 0

Rahul Tripathi
Rahul Tripathi

Reputation: 172458

Try this:

select * from mem_info where hashtag like '%love%' and username <>'qq';

Upvotes: 2

Naveed Ramzan
Naveed Ramzan

Reputation: 3593

select * from mem_info where username <> 'qq';

Upvotes: 0

Related Questions