I need to read the column value of the following query
SELECT strtime('%Y-%m', created_at) as field FROM table GROUP BY field
the type of column field is 3 (I assume it is blog), but I need string
How should I?
Updated
const char* sql = "SELECT CAST(strftime('%Y', created_at) as INTEGER) as year FROM table GROUP BY year
if (SQLITE_OK == sqlite3_prepare_v2([AppDelegate db], sql, -1, &queryhandle, NULL)){ while(SQLITE_ROW == sqlite3_step(queryhandle)){
NSSTring* year = [NSString stringWithFormat:@"%d",sqlite3_column_int(queryhandle, 0)];
this code gives me 3460 as year
(have checked cast as integer, and cast as varchar and sqlite3_column_text function)