MySQL Forums
Forum List  »  Newbie

Order by desc on AVG(value) => NULL values in first
Posted by: Alexis Bataille
Date: July 13, 2005 04:08AM

Hi,

My query is :

SELECT AVG(sucre) AS sucre, AVG(qualite) AS qualite, AVG(gout) AS gout, parfum, marque, count(sucre) AS nb_eval, tabacs.id
FROM tabacs
LEFT OUTER JOIN tabacs_notes ON tabacs.id=tabacs_notes.tabac
GROUP BY tabac, tabacs.id
ORDER BY sucre DESC
LIMIT 00, 10

According to mysql documentation, NULL values of "sucre", "qualite" and "gout" must be in last with this query :

"When using ORDER BY, NULL values are presented first, or last if you specify DESC to sort in descending order. Exception: In MySQL 4.0.2 through 4.0.10, NULL values sort first regardless of sort order. "

However NULL values are in first.

I'm using mysql 3.23.58.

What is the problem ? Is it possible to transform NULL values to 0 ?

Thanks !

Bye,

Alexis.

Options: ReplyQuote


Subject
Written By
Posted
Order by desc on AVG(value) => NULL values in first
July 13, 2005 04:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.