database - mysql conditional select based on a sale price -


i have database of products. 1 of attributes normal price (price), sale price (sale_price), sale expiration date (sale_expires) , sale price never expires flag (sale_never_expires).

i can write nice query gets me basic information on product , current price:

select stock,name, (case when (sale_never_expires='y' , sale_price > 0.0) or (sale_expires >= replace(curdate(),'-','') , sale_price > 0.0) sale_price else price end) current_price inventory delete_flag=0;

but that's not need. need able write query returns products in inventory current price less given amount, $100 sake of example. need matching records , worry formatting later.

i've tried , tried find way write i'm stuck. can do??

select * tablename current price <100

should work fine unless i've misunderstood.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -