Search code examples
mysqlsqlobjective-cnspredicate

NSPredicate JOIN two table OBJECTIVE C


I'm working on an IPAD project, and I need to JOIN two table. Because I have to fetch the JOIN result.

For Examples

SELECT *
FROM Table1 t1
JOIN Table2 t2 ON t1.id2 = t2.id1
WHERE [condition]

How I can do that with NSPredicate? And if is possibile create a View with this query?


Solution

  • If you want to use NSPredicate

    Limitations: You cannot necessarily translate “arbitrary” SQL queries into predicates or fetch requests. There is no way, for example, to convert a SQL statement [...] into a fetch request. You must fetch the objects of interest, then either perform a calculation directly using the results, or use an array operator.

    Documentation