I am using core data first time in my application for my problem I have done google a lot but I didn’t find specific solution.
I have Entity:SubCategory
Attributes:mainCategoryId,subCategoryName.
Now I want to fetch the data like
Select subCategoryName from SubCategory where mainCategoryId=1;
The code which I have implemented is as follows:
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"SubCategory" inManagedObjectContext:managedObjectContext];
[request setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SubCategoryName == %@",@"Triangular1"];
[request setPredicate:predicate];
NSError *error;
arrSubCategory = [managedObjectContext executeFetchRequest:request error:&error];
How can I fetch similar kind of data in coredata
share your ideas
thanx in advance.
From your question what you need is,
So your code will look like,
The above is just a sample code. Actual implementation could be different based on your requirement.
A tutorial on coredata is here. Check that out as well.