php - Why is mysql calculation of maximum and minimum values ​​inaccurate?
滿天的星座
滿天的星座 2017-05-16 12:58:47
0
1
446

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?

滿天的星座
滿天的星座

reply all(1)
左手右手慢动作

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template