I'm trying to do a query to select a bunch of rows by some values. This is an example of my table:
*my_table*
number item status
01 hat on delivery
01 gloves delivered
01 sock cancel
02 hat cancelled
02 gloves delivered
02 sock cancelled
I´d like to do send all rows which are delivered or cancelled values to archive. I tried something like this,
Select *
from my_table
where status = "cancelled" and status = "delivered"
but it didn´t work.
As you said you should use or:
Select *
from my_table
where status = 'cancelled' or status = 'delivered'
Mostly because status can not have the two values at the same time.
You have to use OR clause
Select *
from my_table
where (status = 'cancelled' or status = delivered);
Make sure you enclose in brackets if you use or condition when ever you have multiple WHERE clauses
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.