count and groupby together in one query

后端 未结 2 1866
醉话见心
醉话见心 2021-01-29 06:22

The following query is fetching some product info on a page which is fine, but I also want to show the number of the product that it occurs as a text, however, I used grou

2条回答
  •  伪装坚强ぢ
    2021-01-29 06:28

    Your query won't work. Try like this;

     "SELECT pro_id,count(*) FROM cart  WHERE session_id='" . $_SESSION['session'] . "' GROUP BY 
      pro_id  "
    

提交回复
热议问题