Find out a set of results for sqlite, and then continue to check this group of results by for cycle. Is there an easy way?

find out a set of results for sqlite, then run a for loop on this group of results and continue to check the database with sqlite to get similar results. Here is the method I am currently using. Is there an easy way?

sources of topics and their own ideas

related codes

  • (void) AccordingtoWithBlockReult: (void (^) (NSArray *) BlockResultArray

Radicl: (NSString *) radicl {

NSString * Sql = [NSString stringWithFormat:@"SELECT GROUP_CONCAT(DISTINCT b)FROM tableA WHERE R = "%@ "",r];
NSArray * array1 = nil;
FMResultSet * set =   [self.db executeQuery:Sql];
while ([set next]) {
    array1  = [[set stringForColumn:@"GROUP_CONCAT(DISTINCT b)"] componentsSeparatedByString:@","];
    array1 = [array1 sortedArrayUsingComparator:[self sort]];
}
NSMutableArray * tmpArray = [[NSMutableArray alloc]init];

[array enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
    NSString * Sql2 = [NSString stringWithFormat:@"SELECT GROUP_CONCAT(DISTINCT name)FROM tableA WHERE  R = "%@ " and b = "%@"",radicl,obj];
    [self.dbQueue inDatabase:^(FMDatabase *db) {
        NSArray * array2 = nil;
        CollectionCategoryModel * model= nil;
        FMResultSet * set =   [db executeQuery:BuShouSql2];
        while ([set next]) {
            array2  = [[set stringForColumn:@"GROUP_CONCAT(DISTINCT name)"] componentsSeparatedByString:@","];
            model = [CollectionCategoryModel itemWithDataArray:[[NSMutableArray alloc]initWithArray:array2] sectionTitle:[NSString stringWithFormat:@"%@",obj]];
        }
        [tmpArray addObject:model];
    }];
}];
BlockResultArray(tmpArray);

}

[self.dbQueue inDatabase: ^ (FMDatabase * db)}];

can you use this method to merge sql1 and slq2 and find out array1 and array2 at the same time? thank you

Jun.09,2022
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e75f67-5b3b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e75f67-5b3b3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?