select a set of records [message #20820] |
Sun, 23 June 2002 23:15 |
swapna
Messages: 11 Registered: May 2002
|
Junior Member |
|
|
I have a requirement here.
I'll explain that requrirement with a simple EMP table example.
Take a case i have lots of records in EMP TABLE with a salary column in it. If i take sum(salary) of all employee's it will be 1 Lakh.
Now my actual requirement is I want only those many records from the employee table whose sum of salaries is 50,000. Ignore all other records. I dont have any condition to get which employee records should appear in the output, but the condition is SUM(salary) is 50,000.
Hope iam clear in explaining my requirement.
|
|
|
|
Re: select a set of records [message #20873 is a reply to message #20820] |
Thu, 27 June 2002 01:14 |
moloy
Messages: 8 Registered: June 2002
|
Junior Member |
|
|
i think this query may help u and u can change to u'r
reqiurement.Just take the idea.
select EMPNO,ENAME, sum(sal) from emp group by rollup(EMPNO,ENAME) having sum(sal) <5000;
|
|
|