I've got a sqlite table with sub_id's, these are stored as strings. When I order with this column, I get my data ordered like this:
1, 10, 13, 16, 2, 23, etc
How can I order them numerically?
My code:
var id = Expression<Int>("id")
let m_id = Expression<String>("m_id")
let chapters = try self.database.prepare(self.chaptersTable.order(self.m_id))
for chapter in chapters {
print("chapter Id: \(chapter[self.m_id])")
idsChapters.append(chapter[self.id])
mIdChapters.append(chapter[self.m_id])
}
I can't use change may database format due to Android compatibility.