sql - Need help performing a complex CoreData task -


It would be difficult with pure SQL and I'm not sure how to do this with core data. Is it possible to come up with a pre-requisite or do I need to do this program?

Suppose (using text text) I have a database of employees, some of which are managers and nothing else. I want a list of those managers who have an employee named "John" in their department (or whatever)

  Select employees where the name is "John *" The manager's name will never be "John" anytime.  

Then for each record in that table, I will say:

  select from employees where ROLE = "MANAGER "And the department = (current department)  

I think it can be done in a single SQL query, although it is not certain how - but in any case I have a solution to the coreadata I am searching.

Thank you! In core-data (not writing the correct syntax) follow these steps:

Bring the array of departments in the name of employee with Joy
  • With the role as manager, the workers were brought back and returned before being present in the array.
  • If you tell me the exact syntax

    The following are the single DB queries. In this inquiry, in the initial part of the job, along with the employee, along with the employee, the staff will look for an employee with the role manager and the department in the form of department.

    Choose from ROLE = MANAGER and DEPARTMENT (employee's selective department employee where name is "John *")

    Comments