Hive where子句中的配置单元子查询

Hive where子句中的配置单元子查询,hive,hadoop2,Hive,Hadoop2,我是新来的请帮帮我,我有一个表名prac,我需要 找到比产品鼠标利润(价格成本)更高的产品。我尝试了下面的查询,但它不起作用 select product_name,price-cost from prac where price-cost > (select price-cost from prac where product_name='mouse') 我的数据是 id,product_name,product_type,price,cost,date 100,maker,

我是新来的请帮帮我,我有一个表名prac,我需要 找到比产品鼠标利润(价格成本)更高的产品。我尝试了下面的查询,但它不起作用

select product_name,price-cost 
from   prac 
where  price-cost > (select price-cost from prac where product_name='mouse')
我的数据是

id,product_name,product_type,price,cost,date
100,maker,stationary,25,22,2008-01-15
101,mouse,computer,450,350,2009-04-16
102,white  board,stationary,450,375,2010-06-25
103,sony viao,computer,35000,42000,2010-09-21
我得到了答案

select a.*,a.price-a.cost profit
from prac a 
join (select price-cost p from prac where p_name='Maker') b 
where a.price-a.cost>b.p;

请让我知道是否有其他方法来解决这个问题。