error #1349 view's select cluse contains a subquery in the from clause

Monday, May 5, 2014

Here is my code:



SELECT CAST.first_name,
CAST.last_name,
AWARDED.castID,
COUNT(*) AwardsWon
FROM AWARDED,
ROLE,
CAST
WHERE ROLE.role = "Director"
AND ROLE.castID = AWARDED.castID
AND ROLE.movieID = AWARDED.movieID
AND AWARDED.castID = CAST.castID
GROUP BY castID
HAVING COUNT(*) =
(SELECT MAX(cnt) FROM
(SELECT COUNT(*) cnt FROM AWARDED GROUP BY CastID
) z
)


When I try and create a view from this code though, I get an error of the form: #1349 views slect contains a subquery in the from clause. Are there any ways that can be worked around?







http://ift.tt/1uoFmJ7