目前我尝试将以下SQL查询转换为NSPredicate:
SELECT name FROM person WHERE tournament='x' AND rankingID = (SELECT id FROM ranking WHERE place=1 AND round='final');
排名是一个人的NSSet。 我曾经这样试过:
NSPredicate(format: "tournament = %@ AND ANY rankings.place = 1 AND ANY rankings.round = 'final'", selectedTournament!)
但那不能做我想做的事。 :(
答案 0 :(得分:0)
好的,我想我做到了,这是我的解决方案:
NSPredicate(format: "tournament = %@ AND SUBQUERY(rankings, $ranking, $ranking.place = 1 AND $ranking.round = 'final').@count > 0", selectedTournament!)