今天自己给程序嵌套了fmdb,学习了fmdb的用法,总结一下经验,主要是查询是用like和NSSting结合,在这里我只粘贴sql语句
1:以什么开头
NSString *selectString = [NSString stringWithFormat:@"SELECT * FROM person WHERE person_name LIKE ‘%@%%‘",name];
2:包含什么
NSString *selectString = [NSString stringWithFormat:@"SELECT * FROM person WHERE person_name LIKE ‘%%%@%%‘",name];
3:以什么为结尾
NSString *selectString = [NSString stringWithFormat:@"SELECT * FROM person WHERE person_name LIKE ‘%%%@‘",name];
最后贴上常规的sql语句
1:以什么为开头
SELECT * FROM Persons WHERE City LIKE ‘N%‘
2:包含什么
SELECT * FROM Persons WHERE City LIKE ‘%lon%‘
3:以什么为结尾
SELECT * FROM Persons WHERE City LIKE ‘%g‘
时间: 2024-11-10 11:51:57