samedi 30 janvier 2016

Max value with ALL operator in sqlite

There are two tables:

Movie(mID int, title text, year int, director text);
Rating(rID int, mID int, stars int, ratingDate date);

I want to make a query with ALL operator where I get the title of the movie and max stars that this movie received.

I have tried the following:

SELECT Title, Stars
FROM Movie m, Rating rt
WHERE m.mID=rt.mID AND stars>=all(SELECT stars FROM rating rt, movie m WHERE m.mid=rt.mid);

I get the error:

Error: near "all": syntax error

I can't understand what I am doing wrong here.

Aucun commentaire:

Enregistrer un commentaire