mysql>
SELECT aid, @aid:=artist.artist_id, aid FROM artist,album -> WHERE album.artist_id=@aid;Empty set (0.00 sec)
This returns nothing since there’s nothing
in the variable to start with, the
WHERE
clause tries to look for empty artist_id values. If we modify the query to use artist.artist_id as part of the
WHERE
clause, things work as expected:
mysql>
SELECT aid, @aid:=artist.artist_id, aid FROM artist,albumShare with your friends: