duh right off bat you'd think, "use order , column" have values of:
- a
- z
- b
- a
- z
and when sort them using query:
select * diaries order title asc; i this:
- a
- b
- z
- a
- z
when want this, first issue:
- a
- a
- b
- z
- z
i had same sorting issue else where, second issue, able fix this: temporarily putting characters in lowercase
for (nsstring *key in [dicgroupedstories allkeys]) { [dicgroupedstories setvalue: [[dicgroupedstories objectforkey: key] sortedarrayusingcomparator:^nscomparisonresult(id a, id b) { nsstring *stringa = [[a objectstory_title] lowercasestring]; nsstring *stringb = [[b objectstory_title] lowercasestring]; return [stringa compare: stringb]; }] forkey: key]; } only reason why don't use comparator sort first issue bc don't want execute query sort them use array.
question: want know if there's way sort them how want, did in second issue, in sql query
objects id a , id b arrays contain other objects title, date created, description, etc.
objectdiary_titlereturnsnsstring
in sql, can use lower() or upper() functions in order by:
order lower(diaries), diaries
Comments
Post a Comment