Jump to content

PROBLEMS WITH "SELECT... AS" HELP


triphis

Recommended Posts

Awsome! thank you, it worked.

 

However, I have another question: If, say, for ID #3, votes=0, and points=0, the average will not even show up (you cant divide 0 by 0). For some reason, id #3 is placed ABOVE other IDs with actual averages. Ive tried both ASC, and DESC and the \"empty\" values do not move, only the IDs with actual averages, beneath them move. For example:

DESC

ID Average

3 --- 0

2 --- 0

4 --- 5.2

1 --- 4.7

ASC

ID Average

3 --- 0

2 --- 0

1 --- 4.7

4 --- 5.2

Is there anyway to fix this? This doesn\'t work (because the empty values are NOT 0, they simply do not exist)

SELECT id, name, points, votes, points/votes AS average WHERE average > 0 FROM ratings ORDER BY average DESC LIMIT 10

Any other suggestions?

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.