I have a table like this
poll_id|poll_item ------------------ 1 | John 1 | John 1 | John 3 | John 1 | Bond 1 | Austin
How can I get the count of all values with Poll_id = 1 so I can get
John | 3 Bond | 1 Austin | 1
using sql
Advertisement
Answer
Use group by
with where
:
select poll_item, count(*) from t where poll_id = 1 group by poll_item;