kamal213 Posted August 9, 2012 Share Posted August 9, 2012 Hi guys, Please could you tell me how you would calculate the sum of a column..but of each distinct value in a a table? So for example if the distinct values of a salesman in your table are: John, Bill and Bob how would you calculate there total sales without manually typing "count where salesman =John" etc Please let me know if you need more information. Thanks Quote Link to comment Share on other sites More sharing options...
Barand Posted August 9, 2012 Share Posted August 9, 2012 SELECT salesman, SUM(sales) as total FROM tablename GROUP BY salesman Quote Link to comment Share on other sites More sharing options...
kamal213 Posted August 9, 2012 Author Share Posted August 9, 2012 Your right!! tried it already and it works!!! Perfect! Thanks for your help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.