How to construct a query for the following scenario:
I have three tables:
- People
- Books (linked with people on
peopleserno) - Videos (linked with people on
peopleserno)
I want to create an SQL where the output gives one row containing how many books & videos a specific person has read/watched.
Example output:
John | 3 (books) | 2 (videos)
I have tried things like this, but it doesn't work:
select a.name,
count(b.serno) as books,
count(c.serno) as videos
from people a,
books b,
videos c
where a.serno = b.peopleserno
and a.serno = c.peopleserno
Thank you.