I have two "tables" such as:
- PEOPLE (ID / NAME)
1 | JOHN
2 | MARY
3 | PETER
- MESSAGES (ID / PERSON_ID / TEXT)
1 | 1 | 'Text'
1 | 1 | 'Text 2'
1 | 2 | 'Text 3'
1 | 3 | 'Text 4'
How can I get the number of messages of each person? Just like:
(PERSON_ID / NAME / MESSAGES)
1 | JOHN | 2
2 | MARY | 1
3 | PETER | 1