【发布时间】:2013-11-21 09:21:56
【问题描述】:
我在 iphone 应用程序中使用 join 从 sqlite 表中获取数据,它可以很好地获取数据,但它没有得到准确的数据,这是我的查询
select = [[NSString alloc] initWithFormat:@"select * FROM ContentMaster LEFT JOIN Category ON ContentMaster.CategoryID= Category.CategoryID LEFT JOIN Topic ON ContentMaster.TopicID=Topic.TopicID where ContentMaster.ContentTagText='%@' OR ContentMaster.ContentTitle='%@' AND Category.CategoryName='%@' AND Topic.TopicName='%@'",appDelegate.tagInput,appDelegate.tagInput,appDelegate.categoryName,appDelegate.topicName];
NSLog(@"Select is %@",select);
假设CategoryName='Product' 和Topic='M2M Operations',ContentTagText='Office' 和ContentTitle='Office' 所以当结果出现时,它会显示ContentTag='Office' 的所有记录,但它不仅仅显示ContentTag='Office' 和@ 的那些记录987654328@ 和Topic='M2M Operations'。我想可能是我缺少运营商,知道如何解决这个问题。谢谢
【问题讨论】:
标签: ios iphone sql sqlite join