Skip to content
Advertisement

How to get the sum of specific entry in mysql?

For example if I want to get the agent codes whose sum of order amount is greater than 4000. what query should I use in mysql?

My table is as follows:
k

Advertisement

Answer

If you just want the AGENT_CODE in your query then following will help

SELECT AGENT_CODE FROM yourTableName GROUP BY AGENT_CODE HAVING SUM(ORD_AMOUNT)>4000;

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement