开发者

mysql count query

开发者 https://www.devze.com 2023-01-20 03:10 出处:网络
I have a mysql table set up like this 开发者_如何学JAVA id | refference_id | data Is it possible to count the number of entries for each refference_id all in the query ? SELECT

I have a mysql table set up like this 开发者_如何学JAVA

id | refference_id | data

Is it possible to count the number of entries for each refference_id all in the query ?


SELECT
  refference_id,
  COUNT(*)
FROM
  table
GROUP BY
  refference_id 


select count(distinct refference_id) as myResult from myTable;

0

精彩评论

暂无评论...
验证码 换一张
取 消