Abdullah Salma
Abdullah Salma

Reputation: 570

SQL: selecting different values from one column in db's table

I have a table called replies. There is a column inside it called approval.

The values I used are yes no, and disapproved

Is there a way to select the replies in approval column with two values ? yes and no.
because I don't want to show the disapproved replies

I search the web and stackoverflow. i got no where maybe because I didn't use the right key words for my question.

Upvotes: 0

Views: 110

Answers (3)

David
David

Reputation: 3323

Will this work:

SELECT * FROM replies WHERE approval != 'disapproved'

Upvotes: 0

Raffaele
Raffaele

Reputation: 20885

Simply use the IN in the WHERE clause:

SELECT * FROM replies WHERE approval in ('yes', 'no');

Live fiddle. Is this what you want?

Upvotes: 0

Erwin Brandstetter
Erwin Brandstetter

Reputation: 659367

SELECT * FROM replies WHERE approval IN ('yes', 'no');

Or if there are not other values possible than the three you mentioned:

SELECT * FROM replies WHERE approval <> 'disapproved';

Upvotes: 2

Related Questions