iphone - Core Data - How to do a SELECT DISTINCT specific columns! and preserve whole Table -


i trying create nsfetchrequest produces results uitableview.

it should find distinct 'partnername' column. result of [this] rest of columns produced. ( recenetly )

example)

partnername ---------- date

  • a ------------------ 8/15
  • a ------------------ 8/14
  • b ------------------ 8/15
  • b ------------------ 8/10
  • c ------------------ 8/20

->

partnername ---------- date

  • a ------------------ 8/15
  • b ------------------ 8/15
  • c ------------------ 8/20

            appdelegate *delegate = [uiapplication sharedapplication].delegate;         nsmanagedobjectcontext *context = [delegate managedobjectcontext];          nsfetchrequest *request = [[nsfetchrequest alloc] init];         nsentitydescription *entity = [nsentitydescription entityforname:@"chat" inmanagedobjectcontext:context];          nssortdescriptor *sort = [[nssortdescriptor alloc] initwithkey:@"date" ascending:no];         [request setsortdescriptors:@[sort]];          [request setentity:entity];         [request setresulttype:nsdictionaryresulttype];         [request setpropertiestofetch:[nsarray arraywithobjects:@"partnername",nil]];           [request setreturnsdistinctresults:yes];          // execute fetch         __autoreleasing nserror *error = nil;          nsarray *objects = [context executefetchrequest:request error:&error]; 

i don't know how distinct 'just column'- value. not whole data


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -