【发布时间】:2015-08-22 13:51:28
【问题描述】:
所以我想按价格订购产品 - ASC 和 DESC,但有些产品将在数据库中填写 discountprice 列,如果是这样 - 应该考虑到它们而不是 price 字段。
所以目前我有这个:
SELECT * FROM products ORDER BY price ASC,但是我怎样才能为该特定产品的ORDER 子句附加if (discountprice != '' AND discountprice != NULL) then use discount price 之类的内容?
【问题讨论】:
-
为什么要 discountprice != '' ?不是数字数据类型吗?!?