mysql - Join other table to get count -
i have table contains items:
items: id, body, user_id
and second table constains votes:
items_votes: id, item_id, type
i getting items simple query:
select * items
how can votes count every item in query?
try out this...
select item.id, item.type, item.user_id, count(*) items item inner join items_votes iv on item.id = iv.item_id group item.id
Comments
Post a Comment