Help Please, working with AVG

Analytics
N/A

Help Please, working with AVG

Hi all,

I am trying to do a statement equivalent to the following one from Oracle;

SELECT DISTINCT A.EMPLOYEE_NBR
FROM EMPLOYEE_POSITION A, EMPLOYEE_POSITION_CTRL B
WHERE (SELECT AVG(SALARY) FROM EMPLOYEE_POSITION) > ((SELECT AVG(SALARY) FROM EMPLOYEE_POSITION_CTRL) * .05)+ (SELECT AVG(SALARY) FROM EMPLOYEE_POSITION_CTRL)
OR (SELECT AVG(SALARY) FROM EMPLOYEE_POSITION) < ((SELECT AVG(SALARY) FROM EMPLOYEE_POSITION_CTRL)-(SELECT AVG(SALARY) FROM EMPLOYEE_POSITION_CTRL) * .05)

Basically I am trying to determine if the AVG of salary in table A is within 5 percent of table B. It works for all other db's but in TD i get errors and i've tried different things with no luck. The datatype is Float. If somebody could help me i would sincerely appreciate it, were turning our wheels here. For more info or to contact me directly please respond to this post.
2 REPLIES
N/A

Re: Help Please, working with AVG

Are you sure about your code ?
I don't see any reference to A or B alias in the WHERE clause.
rgs
N/A

Re: Help Please, working with AVG

You posed the very same question on 3/6 and it was answered to your satisfation. Why are you asking the same questin again?

http://www.teradata.com/teradataForum/Topic10827-9-1.aspx