SQL WHERE插入

时间:2013-11-23 03:50:32

标签: sql oracle

所以我有这个片段:

SELECT Recording_artist.artist_name,Musical_genre.musical_genre,
COUNT(Musical_genre.musical_genre) AS Songs
FROM Recording_artist
FULL OUTER JOIN Album
ON Recording_artist.recording_artist_id = Album.recording_artist_id
RIGHT OUTER JOIN Song
ON Album.album_id = Song.album_id
INNER JOIN Musical_genre
ON Album.musical_genre_id = Musical_genre.musical_genre_id
GROUP BY Recording_artist.artist_name,Musical_genre.musical_genre;

我需要放一个WHERE musical_genre = 'Rock',但似乎甲骨文不希望我把它放在任何地方......

1 个答案:

答案 0 :(得分:0)

如果我理解你的问题,这就是你想要的?:

SELECT Recording_artist.artist_name,Musical_genre.musical_genre,
    COUNT(Musical_genre.musical_genre) AS Songs
FROM Recording_artist
    FULL OUTER JOIN Album
        ON Recording_artist.recording_artist_id = Album.recording_artist_id
    RIGHT OUTER JOIN Song
        ON Album.album_id = Song.album_id
    INNER JOIN Musical_genre
        ON Album.musical_genre_id = Musical_genre.musical_genre_id
WHERE Musical_genre.musical_genre = 'Rock'
GROUP BY Recording_artist.artist_name,Musical_genre.musical_genre;

并且,这个问题有mysql标签。但似乎是甲骨文的问题。