I'm writing a program for our sales department and need some help. I have a spreadsheet that is loaded into a MySQL database, the database consists of trailer sales of 6 different companys including the one I work for. They want to see a total for every state as well as a total for companys that sold a trailer in that state, so basically I need to total trailer sales in each state and then break it down to who sold what in that state. I have figured out how to get the a total for every state I just cant figure out how to get a total for each company in that state.
Right now I'm using
$sql = SELECT COUNT(state), state, make, body
FROM test
WHERE body = 'GRAIN'
GROUP BY(state)
ORDER BY make DESC, state DESC";
Please can someone help