Hi, Thanks in advance for any help someone could offer.
I'm trying to display a list of stories submitted to my site from a table titled stories, the name of the person who submitted the story and how many comments about the story have been posted.
I'm working with three tables.
The Stories table [story_id] [user_id] [storytitle] [storycategory]
The Team Table [team_id] [teamname]
The Comments Table [comment_id] [story_id] [user_id]
my query should be something like:
Get the stories
(select * from stories)
Also the team name of the person who submitted them
(inner join teams ON stories.user_id = teams.team_id)
And count for me how many times a comment has been made for each story.
(count how many comments.story_id =stories.story_id)
i can easily obtain the story titles and the team names that submitted with
SELECT * from stories
inner join teams ON stories.user_id = teams.team_id
but I have no idea how to count how many comments.story_id = stories.story_id
again,
thanks in advace.