Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to efficiently fetch one column using CoreData

I have a Table with 50,000 records (table has 8 columns). I need to display only 1st column on the Table. I need an array which contains all data from Table only from 1st column. How to use NSFetchRequest to get all record from 1st column of the Table using Core Data?

like image 643
sach Avatar asked Oct 03 '11 11:10

sach


1 Answers

You need to use setPropertiesToFetch: method like

[request setPropertiesToFetch :[NSArray arrayWithObject:@"<#Attribute name#>"]];

e.g.,

[fetchRequest setPropertiesToFetch:[NSArray arrayWithObjects:@"ColName", nil]];

Refer link

like image 163
Saran Avatar answered Sep 19 '22 17:09

Saran