这是我的代码,稍后我会将其放入 php 中,但目前我在提供的查询测试器中使用它。我们正在做一级凯文培根而不是六级。
我的查询如下:
SELECT name,year
FROM actors
JOIN roles ON roles.actor_id = actors.id
JOIN movies ON movies.id=roles.movie_id
WHERE actors.first_name= 'kevin' AND actors.last_name='bacon' OR actors.first_name= 'sean' AND actors.last_name='penn'
ORDER BY movies.name;
结果是
Animal House 1978
Apollo 13 1995
Few Good Men, A 1992
Footloose 1984
Hollow Man 2000
JFK 1991
Mystic River 2003
Mystic River 2003
Planes, Trains & Automobiles 1987
Stir of Echoes 1999
如何让它只显示神秘河?