Deric Santhosh
Deric Santhosh

Reputation: 17

Filter multiple conditions from same column

My query is, that I want to filter more than one condition from one column same time. ex)

enter image description here

I want to filter both "Thrissur" and "Ernakulam" from the Place column simultaneously. So I tried something like this:

SELECT *
FROM student
WHERE Place = "Thrissur" AND Place = "Ernakulam";

Can you please tell me the correct script?

Upvotes: 0

Views: 806

Answers (1)

tnavidi
tnavidi

Reputation: 1393

it should be

SELECT * from student where Place="Thrissur" OR Place="Ernakulam";

alternatively

SELECT * from student where Place in ("Thrissur","Ernakulam");

The last one is better if you need to add more places, and it can be replaced by subqueries example SELECT * from student where Place in (Select place from favorites)

Upvotes: 1

Related Questions