首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Mysql >

求 where 有关问题

2012-05-20 
求 where 问题select *, IF(isnull(price1),price2, price1) as pricefrom goodswhere price100会有一个

求 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

热点排行