get count from table with foreign key This is a sample table and sample data only. I have three tables: