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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.