Page 1 of 1

Need advise implementing Sql Query

Posted: Thu Oct 06, 2005 12:55 pm
by vinod111
I am to create server job for the query: Select empno from emp where salary >avg(salary).. Please let me know

Posted: Thu Oct 06, 2005 1:16 pm
by kcbland
And do what with the result? Write it to another table, a text file, ftp to a mainframe, what? From what database, Oracle, UDB, SQL-Server, using what stage, OCI, ODBC, etc? Do you want user-defined or generated queries?

Your request is one of the first things you do in training. If you haven't had training, might I suggest using the tutorial?

Re: Sql Query

Posted: Thu Oct 06, 2005 2:00 pm
by DeepakCorning
:lol:

Add a drs stage and add the column, table and where condition.
vinod111 wrote:I am to create server job for the query: Select empno from emp where salary >avg(salary).. Please let me know

Posted: Fri Oct 07, 2005 1:10 am
by loveojha2
don't specify the condition in the where clause, specify it in the other clauses since you are using avg(salary), use having option.

Posted: Fri Oct 07, 2005 4:27 pm
by ray.wurlod
This is actually not possible in a single query. You need two passes through the data. You can do this with a nested query in the WHERE clause.

Code: Select all

column > (select avg(column) from table)