读书人

求 where 有关问题

发布时间: 2012-05-20 16:03:12 作者: rapoo

求 where 问题
select *, IF(isnull(price1),price2, price1) as price
from goods
where price>100

会有一个问题Unknown column 'price' in 'where clause',这个price字段本身不存在,求实现语句。

[解决办法]
select * from (
select *, IF(isnull(price1),price2, price1) as price
from goods) A
where price>100

OR

select *, IF(isnull(price1),price2, price1) as price
from goods
where IF(isnull(price1),price2, price1)>100

读书人网 >Mysql

热点推荐