Skip to content

Instantly share code, notes, and snippets.

@3leftturns
Created June 13, 2014 16:55
Show Gist options
  • Save 3leftturns/86b86122c93a4f89281c to your computer and use it in GitHub Desktop.
Save 3leftturns/86b86122c93a4f89281c to your computer and use it in GitHub Desktop.
Got a list of sales in a table and need to summarize total sales for each sales agent? This GIST can help. Selects sales agent and sums their sales, then groups into 1 line per sales agent.
SELECT salesagent, SUM(saleamount) as salestotal
FROM sales.salestable
GROUP BY salesagent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment