Jump to content

count function in multilple tables


tararan

Recommended Posts

hey guys i'm kinda stuck at this one problem. let me explain the issue. I have 3 tables 'movie', 'request', and 'video'. MOVIE table includes the title and MovieID (this is the PK), the REQUEST table includes Customer ID and the MovieID that they are requesting. And finally the Video table includes MovieID, Copynum(there are more than 1 copy for each movieID).i need to show the movie title, number of request for a certain movie title, and the total number of copies of each requested movies.this is what i have so far.select movie.title,count(request.movieID)from movie, requestwhere request.movieID = movie.movieIDgroup by title;this query gives me the title and the number of request for that movie. what i can't figure out is how to add the total number of copies for movies that have been requested. please help! Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...