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); ?> Quote Link to comment Share on other sites More sharing options...
Skipjackrick Posted January 17, 2011 Author Share Posted January 17, 2011 Nevermind.... Boy that was easy.... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.