Ankit
Ankit

Reputation: 41

Oracle query with sum() in the where clause

I have a table which consists two columns amount and description. Now i need something like Select description from tab where sum(amount) > 5000 Which is not possible i guess. Is there any custom method to get this done ?

Upvotes: 3

Views: 13519

Answers (1)

Roger Cornejo
Roger Cornejo

Reputation: 1547

Try something like:

select description, sum(amount)
from tab
group by description
having sum(amount) > 5000
;

Upvotes: 8

Related Questions