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 ?
1 Answer
Try something like:
select description, sum(amount)
from tab
group by description
having sum(amount) > 5000
;
1 Comment
Ankit
Thanks a lot. I need one more help. Accounts table contains acno and acid. Tab consists of acid. To group the above query based on acno i should write. Select acno,description,sum(amount) from tab,accounts where accounts.acid=tab.acid group by acno,description having sum(amount) > 5000. ???