I have a table having data.
id type
1 max
1 sam
1 rom
2 jak
I want to retrieve all the type where id=1;
if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
NSString *aRecord = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];
NSLog (@"%@",aRecord);
}
this statement retrive me only the last record. How can i get all the records?
how to catch these records in the variable. I am using aRecord but it store only last record. So this is the main concern
The sql ro do this is simply:
do something like this:
As Peter Hosey points out in the comments, this will give you one string with all three records separated by a space. You probably want to populate an array with these records instead.