Multiple WHERE conditions in mySQL query
Posted: Sat Mar 25, 2006 9:32 am
I have a table for 'orders' with a column named 'status' - after an order is placed it's marked 'paid', 'open' or 'archived'
Orders are taken online or by phone. I only want orders with order_type marked 'online'
I'm trying to retrieve all 'online' orders marked 'paid' or 'archived' but NOT 'open'
I tried this query but it doesn't work:
It brings up both 'online' orders and 'phone' orders. I only want the 'online' orders.
All suggestions appreciated.
Thanks in advance.
mc
Orders are taken online or by phone. I only want orders with order_type marked 'online'
I'm trying to retrieve all 'online' orders marked 'paid' or 'archived' but NOT 'open'
I tried this query but it doesn't work:
Code: Select all
"SELECT * FROM orders WHERE order_type='online' AND status='paid' OR status='archived'";All suggestions appreciated.
Thanks in advance.
mc