Siggles Posted July 31, 2008 Share Posted July 31, 2008 Hi I have a query.. SELECT predictions.resultmfc, predictions.resultother, predictions.score, fixtures.opponent, fixtures.resultus, fixtures.resultthem, fixtures.homeaway, predictions.id, predictions.username, DATE_format( fixtures.dateplayed, '%M %e, %Y' ) AS newdate, predictions.predictionid, SUM( predictions.score ) AS Total_Score FROM fixtures RIGHT JOIN predictions ON predictions.id = fixtures.id GROUP BY predictions.username ORDER BY dateplayed, username because I have the GROUPBY clause in there it will only display the predictions from my database for one fixture because it will only show one prediciton per user. If I remove the SUM(predictions.score) and GROUP BY sections fromt he query the page displays correctly but I cannot show users individual score for each preidction. If I change the GROUP BY clause to fixtures.opponent then it shows both fixtures but only one prediction from each. Anyone know what I can do here to rememdy this? Link to comment https://forums.phpfreaks.com/topic/117530-solved-group-by-clause-restricting-amount-of-data-a-query-will-show/ Share on other sites More sharing options...
Siggles Posted July 31, 2008 Author Share Posted July 31, 2008 Sorry sorted it, didn't even need SUM in there, so I removed the GROUP BY. Link to comment https://forums.phpfreaks.com/topic/117530-solved-group-by-clause-restricting-amount-of-data-a-query-will-show/#findComment-604532 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.