Jump to content

[SOLVED] mysql error


EchoFool

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.