如何使用 SQLite 在 Where 子句中使用布尔字段 return 数据
How to return data using boolean field in Where clause using SQLite
我有一个简单的 table,其中包含以下数据
从 table 记录中,我只是尝试获取 Primary
字段设置为 1 的记录。为此,我只需使用以下内容:
select *
from ProductProductPhoto
where ProductId = 12
and Primary = 1
但是我收到了 SQLite 报告的语法错误,而且没有任何原因。
我也尝试过以下形式的查询:
select *
from ProductProductPhoto
where ProductId = 12
and Primary
但运气不好,SQLite 工具在浏览器中的错误 return 是:
"near "Primary": syntax error: "
知道这个语法需要怎样吗?
primary
是一个reserved word in SQLite,你应该用双引号转义"
:
select *
from "ProductProductPhoto"
where "ProductId" = 12
and "Primary" = 1
我有一个简单的 table,其中包含以下数据
从 table 记录中,我只是尝试获取 Primary
字段设置为 1 的记录。为此,我只需使用以下内容:
select *
from ProductProductPhoto
where ProductId = 12
and Primary = 1
但是我收到了 SQLite 报告的语法错误,而且没有任何原因。
我也尝试过以下形式的查询:
select *
from ProductProductPhoto
where ProductId = 12
and Primary
但运气不好,SQLite 工具在浏览器中的错误 return 是:
"near "Primary": syntax error: "
知道这个语法需要怎样吗?
primary
是一个reserved word in SQLite,你应该用双引号转义"
:
select *
from "ProductProductPhoto"
where "ProductId" = 12
and "Primary" = 1