[英]OR operator not working for Breeze Query using Json
我正在使用Breeze api编写客户端查询,并希望使用Json进行相同的操作。
我有一个SQL查询,我将其转换为Json查询,但是它将“或”运算符自动转换为“和”。 请帮忙。
SQL查询
SELECT [Name] FROM [Users] WHERE [Id] IN (1,3) AND [Name] = 'abc' OR [Mobile] = '111'
轻松处理JSON查询
var jsonQuery = {
"from": 'User',
"where": [{
"and": [{
"Id": { "in": [1, 3] },
"Name": { "eq": 'abc' }
}],
"or": [{
"Mobile": { "eq": '111' }
}]
}]
}
周杰伦的解决方案是正确的,但正如他指出的那样,这是语法问题。 正确的查询是:
var jsonQuery = {
"from": 'User',
"where": [{
"or": [
{ "and": [
{ "Id": { "in": [1, 3] }},
{ "Name": { "eq": 'abc' }}
]
},
{ "Mobile": { "eq": '111' }}
}]
}]
}
好的,我正在SO编辑器中对此进行编辑,因此我没有对其执行任何语法检查,但是您应该能够理解
var jsonQuery = {
"from": 'User',
"where": [{
"or": [ {
"and": [ {
"Id": { "in": [1, 3] },
"Name": { "eq": 'abc' }
}],
"Mobile": { "eq": '111' }
}]
}]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.