title: How to get/delete multiple rows in SQLITE table in iOS?
body: <p>My table in SQLITE is in the following format.</p>
  
  <pre><code>id   name      date      height
   1    tt     12-2-15       120
   2    ss     15-3-15       110
   3    tt     14-5-15       120
   ....
   10   tt     19-6-15       130
  </code></pre>
  
  <p>(1)I like to get all rows under name tt in one instruction, then put into two dimensional array. How can i implement it?</p>
  
  <p>(2)How to delete all rows under name tt in one instruction?</p>
  
  <p>My code is in iOS. I couldn't find solution easily.</p>
  
  <p>EDIT:
  Just to share what I implement.</p>
  
  <pre><code>    NSString *databasePath;
      NSString *docsDir;
      NSArray *dirPaths;
  
      //Database
      dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      docsDir = [dirPaths objectAtIndex:0];
      // Build the path to the database file
      databasePath = [[NSString alloc]initWithString:[docsDir stringByAppendingPathComponent: @"RECORDS.db"]];
      const char *dbpath = [databasePath UTF8String];
      if (sqlite3_open(dbpath,&amp; RECORDS) == SQLITE_OK)
      {
          retval = [[NSMutableArray alloc] init];
  
          NSString *query = [NSString stringWithFormat:@"SELECT id, nameid, date, height FROM RECORD WHERE nameid=\"%@\"", currentNameID];
          const char *query_stmt = [query UTF8String];
          if (sqlite3_prepare_v2(RECORDS, query_stmt, -1, &amp;statement, nil) == SQLITE_OK) {
              while (sqlite3_step(statement) == SQLITE_ROW) {
                  char *date = (char *) sqlite3_column_text(statement, 1);
                  int height = (int) sqlite3_column_text(statement, 2);
                  NSString *name = [[NSString alloc] initWithUTF8String:date];
                  HeightInfo *info = [[HeightInfo alloc] initWithInfos:name withheight:(int)height];
                  [retval addObject:info];
  
              }
              sqlite3_finalize(statement);
              sqlite3_close(RECORDS);
          }
      }
  </code></pre>
  
  <p>Thanks</p>