Calculate through the following sql statement, why are some of the results inaccurate
public function get_avgprice_item($category_id){
$sql = "SELECT MAX(yj) as m_max, AVG(yj) as m_avg, Min(yj) as m_min FROM " . $this->get_table('item') . ' where category_id = ' . intval($category_id);
return $this->query_row($sql);
}
No misplacement,
Why are the calculated results like this?
category_id is not the primary key. If it is, just taking one will have no statistical significance. If not, then where is the group by? It’s best to post all the code