0

I have a mysql table set up like this

id | refference_id | data

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

2 Answers 2

1
SELECT
  refference_id,
  COUNT(*)
FROM
  table
GROUP BY
  refference_id 
Sign up to request clarification or add additional context in comments.

1 Comment

yes! thank you. i didn't select the name of the table in the query just the count(*) part that's why it wasn't working :<
0

select count(distinct refference_id) as myResult from myTable;

1 Comment

not as i was looking for. it counts how many different refference_ids i have

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.