tags:

views:

21

answers:

2

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  A: 
SELECT
  refference_id,
  COUNT(*)
FROM
  table
GROUP BY
  refference_id 
madgnome
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 :<
andrei
+1  A: 

select count(distinct refference_id) as myResult from myTable;

Peter Perháč
not as i was looking for. it counts how many different refference_ids i have
andrei