Find outliers in Hive - SemanticException

I'm trying to find some outliers on my database using HIVE and I'm using Standard Deviation technique. My query is:

SELECT ID
FROM data
WHERE ID < (AVG(ID) + STDDEV(ID))
AND ID > (AVG(ID) - STDDEV(ID));


When I run this code I'm getting the following error:

 Error while compiling statement: FAILED: SemanticException [Error 10128]: Line 3:12 Not yet supported place for UDAF 'AVG'


How to solve this problem? Many thanks!

Seems like Hive doesn't let you use avg in a where clause. You can solve this with a subquery.
SELECT id