你的sql有问题,可以参考:select * from LogTaskDetail a where exists (select 1 from LogTask b where b.logTaskDetailID = a.logTaskDetailID and b.content like '%key%' )