select name from person where pid ? (select DISTINCT pid from m_cast where mid =(select mid from movie where title like 'anand'))
。
select DISTINCT pid from m_cast where mid =(select mid from movie where title like 'anand')
返回多个值,但是当作为内部查询传递给主查询时,它没有给出任何结果
答案 0 :(得分:0)
您可以使用联接并避免使用= (subquery)
select DISTINCT pid
from m_cast
inner join movie on movie.mod= m_cast.mid and movie.title like 'anand'
和
select name
from person
inner join (
select DISTINCT pid
from m_cast
inner join movie on movie.mod= m_cast.mid and movie.title like 'anand'
) t on t.pid = person.pid
答案 1 :(得分:0)
SELECT p.Name
FROM Person p WHERE p.PID IN
(SELECT TRIM(mc.PID)
FROM M_Cast mc JOIN Movie m
ON mc.MID = m.MID
WHERE m.title = 'Anand')