Q:

SQL Statement to query average of one column in a table, join and query corresponding column from another table

I have two tables, each set up like this
--------------------------    ---------------------------
|           DVD          |    |          Sells          |
--------------------------    ---------------------------
| dvdid | title | length |    | dvdid | storeid | price |
--------------------------    ---------------------------
|   1   | Alpha |   27   |    |   1   |   100   | 11.99 |
--------------------------    ---------------------------

I'm trying to select the average of Sells.price for each DVD.title, and select both.  Right now I have the following:
SELECT AVG(Sells.price), DVD.title
FROM Sells inner join DVD on Sells.dvdid = DVD.dvdid;

Unfortunately this does not work, I receive the error "Not a single-group group function.  I assume this means I can't SELECT a function like AVG and then a single column to go along with it.  Any ideas?

A:

You need to add DVD.title in Group By
SELECT AVG(Sells.price), DVD.title
FROM Sells inner join DVD on Sells.dvdid = DVD.dvdid
Group by DVD.title --Here

