新手求sql query
一个table, x, y, z 3个字段, 求y-z的最大值所对应的x值,
自己写了query,不过有错误
select temp.a
from       
      (select x a,abs(y-z) b
      from table t
      where z in
      (SELECT z FROM `t` WHERE z > 0)    
      group by x) temp
where temp.b in (select max(b) from temp)
提示 table.temp 不存在
本人初学,还望高手们多多指点
------解决方案--------------------
select temp.a
from    
   (select x a,abs(y-z) b
   from table t
   where z in
   (SELECT z FROM `t` WHERE z > 0) 
   group by x) temp
where temp.b in (select max(b) from (select x a,abs(y-z) b
   from table t
   where z in
   (SELECT z FROM `t` WHERE z > 0) 
   group by x) temp1)