Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Joins

Author  Topic 

ericafisher14
Starting Member

1 Post

Posted - 2013-10-06 : 20:18:54
Write a query to display a summary of user’s NetFlix account queues. Include users with no titles in their queue and sort the output by account id.

this is what my code is so far, and I am getting a blank table. I think I need two joins, and something is wrong with them, but I am unsure what

select account_id, account_firstname + ' ' + account_lastname as account_name, COUNT (title_id) as title_count_in_queue,
MIN (title_avg_rating) as lowest_rated_title, AVG(title_avg_rating)as avg_rating_of_titles,
MAX(title_avg_rating)as highest_rated_title
from nf_titles
join nf_account_titles on title_id = at_title_id
join nf_accounts on at_id = at_account_id
group by account_id, account_firstname + ' ' + account_lastname
order by account_id


Erica Fisher

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-10-07 : 00:24:21
Check whether you have records for the following Query with all JOIN Conditions?
SELECT *
from nf_titles
join nf_account_titles on title_id = at_title_id
join nf_accounts on at_id = at_account_id


If you get NO records for the above SQL then you doesn't have records which satisfy JOIN condition

--
Chandu
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-10-07 : 05:43:45
unless you show us some sample data to illustrate table relationship we wont be able to suggest on why data is not apearing.
Give some 5- 10 sample rows from the tables.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -