i am stuck with sql query.
i want to select product from single table but exlude selected product.
i have wp_product table as
product_id prod_name prod_price prod_rate
1 xyz 100 5
2 pqr 200 6
3 lmn 300 6
I am trying to execute this query
select *
from wp_products
where product_id <>'1' AND prod_price <=200 OR prod_rate='6' OR
order by product_id DESC
LIMIT 4"
using this select * from wp_products where product_id <>'1'; I get result
product_id prod_name prod_price prod_rate
2 pqr 200 6
3 lmn 300 6
and from this above result i want select(check) for all “OR” condition that i used in my tried query.
suggest me how can i get this.
If I’m understanding you correctly – just use parenthesis: