Selecting data from data base form two tables in iphone app
===

i want to select data from the table but those data which has same question id in the questions table and answers table.
Now it selects all the data from answers the code is shown below

         + (void) getAnswers:(NSString*)dbPath{
    
         CereniaAppDelegate *appDelegate = (CereniaAppDelegate *)[[UIApplication sharedApplication] delegate];
    
        if (sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK) {
        
        const char *sql = "select *from answers";
        
         sqlite3_stmt *selectstmt;
        if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) {
            
            while(sqlite3_step(selectstmt) == SQLITE_ROW) {
                
                NSInteger primaryKey = sqlite3_column_int(selectstmt, 0);
                Answers *coffeeObj = [[Answers alloc] initWithPrimaryKey:primaryKey];
                
    
                coffeeObj.answer_text = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectstmt, 3)];
                
                
                
                NSString*testString=coffeeObj.answer_text;
                
                NSLog(testString);
                [appDelegate.answerArray addObject:coffeeObj];
                
                int mycount=[appDelegate.answerArray count];
                
                NSLog(@"This is int of latest %d",mycount);
                
                
                [coffeeObj release];
               }
               }
               }
    
    
         else
             sqlite3_close(database); //Even though the open call failed, close the database connection to release all the memory.
             }

