Jump to content

greatest / least issue


grayashe

Recommended Posts

Hi,

 

I have a table of prices that looks something like this:

 

id    price    discount_price

1    10.00    9.50

2    12.50    0.00

3    15.00    12.00

 

I need a way to be able to select products based on price where the discount_price trumps the actual price as long as the discount price is greater than 0.00. I need to do this in the sql.

 

I had thought about using least(price, discount_price), but can't see a way to ignore discount_price when it is zero.

 

Any ideas?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/204104-greatest-least-issue/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.