mercredi 30 septembre 2015

SQLiteman help needed

Hi I need some help for a uni assignment, I need to answer 2 questions: 1) List the titles of videos that are available in more than one format together with the number of different formats available for each title.

MY query was: SELECT title FROM video WHERE video_id IN ( SELECT video_id, COUNT(format_id) AS AvaliableFormats FROM video_format GROUP BY title HAVING COUNT(format_id) > 1);

But the result says "Query Error: only a single result allowed for a SELECT that is part of an expression"- I'm not sure what this means or what I need to do to fix it?

Q 2 5) List the titles of videos that have an average cost (across formats) that is more than $2.

My Query

SELECT title FROM video WHERE video_id IN ( SELECT video_id FROM video_format
GROUP BY title HAVING AVG(cost) > 2);

But it only brings up one result (row there should be 2).

If anyone can please help I would really really really appreciate it!

Aucun commentaire:

Enregistrer un commentaire