murfitUK Posted June 22, 2009 Share Posted June 22, 2009 The table has a list of payments received including fields `type` and `amount`. My mysql query is:SELECT `type`, SUM(`amount`) AS `amount` FROM `payments` GROUP BY `type` ORDER BY `amount` DESC;which I can use to create an output like thisCash - £250.00Cheque - £125.00Other - £35.50etcI'd like to include the percentage that each type contributes towards the total. In the example above the total is 410.50 so cash will be 60.9%, cheque will be 30.5% and other will be 8.6%. Can this be done in one query? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.