Jump to content

avg mysql/php


karker

Recommended Posts

is it true  ?  in paging 0,92,085,0,50,066,0,73 etc its  coming to mixing

$en_cokk = mysql_query("select baslik,baslik_seo , liked/(liked+hate) avg from hikayeler order by  avg  DESC limit 10");

 

there are two row in database  liked and hate;

how can i take average and sort desc  to page  from database ?   

 

Link to comment
https://forums.phpfreaks.com/topic/236354-avg-mysqlphp/
Share on other sites

Please provide further information, your question uses the wrong words for things and is impossible to answer.

 

-For example, you state:  there are two row in database liked and hate.  I'm guessing you mean there is a column named "liked" that is a varchar and has either "liked" or "hate" in it?

 

-In order to run AVG() you need a numeric column, and it is a summary function, meaning it will be applied to an entire group.

 

-Probably what you want is to us GROUP BY to get groups, but exactly what the GROUP BY needs to be I can only guess.

Link to comment
https://forums.phpfreaks.com/topic/236354-avg-mysqlphp/#findComment-1215171
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.