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:
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;