sql - Group by month and add year and employee -


i have simple table every sale made in few past years. find out maximum sale per month , made , in year , month.

table has following columns:

id, date, amount, employeeid

i group data year(date), month(date), employeeid , use sum(amount) find sale of each employee in each month. group further month(date) , use max on sum(amount) column find maximum sale per month. easy.

after find out when (date) , (employeeid) made particular sale.

group data year(date), month(date), employeeid , use sum(amount) find sale of each employee in each month order sum(amount) desc. highest sellers @ top of results.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -