tags:

views:

22

answers:

1

I have 2 tables and want to query all the album data joined with the artist

artists: artist_id | name

albums: album_id | artist_id | songs

This gives me only the first row

SELECT * FROM albums JOIN artists ON artists.artist_id = albums.artist_id

I want to specify an album id

SELECT * FROM albums 
   WHERE album_id = 101 
JOIN artists ON artists.artist_id = albums.artist_id
+5  A: 

WHERE goes after the JOIN:

SELECT  *
FROM    albums
JOIN    artists
ON      artists.artist_id = albums.artist_id
WHERE   album_id = 101 
Quassnoi