我正在做一个 iPad 项目,UI 中有 3 个表。如果我在每个表中选择行。Sqlite 查询将从表中获取值并运行查询。请在下面找到我的查询。
NSString * str3=tableFou.string4;
NSString * str4=tableFiv.string5;
NSString * str2=tablethr.string3;
sqlite3 *database;
favorite=[[NSMutableArray alloc]init];
if(sqlite3_open([databasePath UTF8String], &database)== SQLITE_OK){
NSString *sql=[NSString stringWithFormat:@"Create view prizeview as SELECT country.name,item_country.id,text.text,substr(text,1,2) FROM country,item_country,prize,item_prize,gender,item_gender,text WHERE country.name = '%@' AND text.item = item_country.item AND country.id = item_country.id AND prize.name = '%@' and text.item=item_prize.item and prize.id = item_prize.id and gender.name = '%@' and text.item=item_gender.item and gender.id = item_gender.id ",str3,str4,str2];
const char *sqlStatement = [sql UTF8String];;
问题是,如果我只选择所有表,则查询正在运行。但如果我选择一个表,我想要结果。我怎样才能做到这一点?