EchoFool Posted June 18, 2009 Share Posted June 18, 2009 I keep getting this error for my query...: Reference 'Points' not supported (reference to group function) What does it mean ? My query is below: <?php $SELECT = mysql_querY("SELECT Sum(listratings.RateNumber+15) AS Points,Count(listings.GameName+15) AS TotalRows,listings.Caption,listings.VotesIn,listings.GameName,listings.Banner,listings.BannerDays,listings.GameID,listings.ShortDescription,listings.UpdatedOn FROM listings INNER JOIN listratings ON listings.GameID=listratings.GameID WHERE listings.Authorised='1' ORDER BY (Points/TotalRows) ASC") Or die(mysql_error()); ?> Ive never seen this mysql error before, what is the reason for it and how do i fix it ? Link to comment https://forums.phpfreaks.com/topic/162796-solved-mysql-error/ Share on other sites More sharing options...
DavidAM Posted June 18, 2009 Share Posted June 18, 2009 I've never seen it before either. But I see that you have aggregate functions (SUM and COUNT) in the SELECT statement, along with non-aggregated columns. I think you need a GROUP BY to make the select work. I'm not sure if the ORDER BY will be a problem once you add the GROUP BY or not. I think it will be OK. If not, you may have to add a column to the select to match the ORDER BY. Try just adding the GROUP BY and let us know if that solves it. Link to comment https://forums.phpfreaks.com/topic/162796-solved-mysql-error/#findComment-859093 Share on other sites More sharing options...
EchoFool Posted June 18, 2009 Author Share Posted June 18, 2009 Argh bingo i needed the GROUP BY Thank you DavidAM Link to comment https://forums.phpfreaks.com/topic/162796-solved-mysql-error/#findComment-859094 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.