sql - MySQL count number occurrences -
sql - MySQL count number occurrences -
i have 2 tables:
category: cat_id|cat_type 1 | 2 | b 3 | c 4 | d and have
meta: met_id|met_name|user_id|met_type 10 | bla | 2 | 1 11 | blabla | 4 | 2 12 | foo | 1 | 3 13 | blafoo | 3 | 4 14 | foofoo | 5 | 4 how can homecoming ?
cat_type|occurences | 1 b | 1 c | 1 d | 2 met_type foreign key category.
select c.cat_type , count(m.met_type) occurrences categoty c left bring together meta m on c.cat_id = m.met_type grouping c.cat_type
mysql sql
Comments
Post a Comment