karker Posted May 13, 2011 Share Posted May 13, 2011 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/236354-avg-mysqlphp/ Share on other sites More sharing options...
gizmola Posted May 13, 2011 Share Posted May 13, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/236354-avg-mysqlphp/#findComment-1215171 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.