Skipjackrick Posted January 17, 2011 Share Posted January 17, 2011 I know we were just discussing this on this other topic... http://www.phpfreaks.com/forums/mysql-help/find-the-largest-value-for-each-group-and-sum/ And it worked beautifully.... But now I want to group those results by the team that each angler is on.... Or SUM those results and group them by team... Is that possible? For example, the following code outputs....... <?php //connect to the db include 'db_connect.php'; //Testing for total inches $total_inches = "SELECT angler, team_id, SUM(mlength) FROM ( SELECT angler, yyyy, team_id, MAX(length) AS mlength FROM submit WHERE yyyy=2010 GROUP BY angler, species_id ) AS zz GROUP BY angler ORDER BY SUM(mlength) DESC "; $total_inches_result = mysql_query($total_inches) or die(mysql_error()); $RowCount = mysql_num_rows($total_inches_result); ?> Link to comment https://forums.phpfreaks.com/topic/224764-find-the-largest-value-for-each-group-and-sum-and-then-sum-those-results/ Share on other sites More sharing options...
Skipjackrick Posted January 17, 2011 Author Share Posted January 17, 2011 Nevermind.... Boy that was easy.... Link to comment https://forums.phpfreaks.com/topic/224764-find-the-largest-value-for-each-group-and-sum-and-then-sum-those-results/#findComment-1161031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.