Query which uses more than one value from the same column? Hello all,
A mysql newbie here with a query-building question that seems simple,
but I can't get the syntax right.
Say that I have three tables with the following columns...
Songs:
-----
song_id
song_title
Singers:
-------
singer_id
first_name
Singers_in_Songs:
----------------
id
song_id
singer_id
(the Singers_in_Songs join table allowing for normalization: one
singer could have many songs, and one song could have many singers
performing in it.)
I know the SELECT to find all the songs featuring a certain singer,
e.g.:
SELECT song_title FROM Songs JOIN Singers_in_Songs USING (song_id)
JOIN Singer USING (singer_id) WHERE Singers.first_name = 'Lucy';
My question is: How do I modify this query to get all song titles in
which 'Lucy' AND 'Linus' are singing, but ONLY those titles in which
they BOTH appear?
Thanks for any hints,
B. |