iphone - OR 运算符在查询 sqlite iphone 中不起作用

标签 iphone sql sqlite

我正在使用 Join 运算符检查表中的两个值,但它不起作用

select = [[NSString alloc] initWithFormat:@"select * FROM ContentMaster LEFT JOIN  Category  ON  ContentMaster.CategoryID= Category.CategoryID where ContentMaster.ContentTitle='%@' || ContentMaster.ContentTagText='%@' ",appDelegate.tagInput,appDelegate.tagInput];

如果我不使用运算符并在 where 子句中使用一个,那么它会显示结果。


select = [[NSString alloc] initWithFormat:@"select * FROM ContentMaster LEFT JOIN  Category  ON  ContentMaster.CategoryID= Category.CategoryID where ContentMaster.ContentTitle='%@'",appDelegate.tagInput];


select = [[NSString alloc] initWithFormat:@"select * FROM ContentMaster LEFT JOIN  Category  ON  ContentMaster.CategoryID= Category.CategoryID where ContentMaster.ContentTagText='%@'",appDelegate.tagInput];

任何想法如何解决这个问题,以便或运算符(operator)工作

最佳答案

在 SQL(尤其是 SQLite)中,运算符 ||通常意味着字符串连接。

如果你想要逻辑 or , 使用运算符 OR .

关于iphone - OR 运算符在查询 sqlite iphone 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20066068/

相关文章:

android - 数据插入数据库,然后应用程序崩溃

iphone - 我如何通过 iphone 项目中的 obj c 方法更改 sqlite 数据库中的表

java - 将字典转换为sqlite数据库

iphone - iOS项目如何继承XIB文件?

iphone - 如何 "flush"Objective-C HTTP session ID? (强制退出 tumblr)

ios - 自定义 UITableViewCell 重新加载行不正确

ios - AFNetworking文件上传

sql - MS Query - 第 1 列上的外连接类似于第 2 列?

sql - 如何在连接查询中显示映射到第二个表中同一列的两列

php - 如何重写我的 PHP 和 MySQL 以按相等的列值对我的 HTML 列表进行分组?