Closed xuyongweb closed 1 year ago
select Orders.* , Customers.customerId as cId from Orders left join Customers on Orders.customerId=Customers.customerId where Orders.shipperId = 2 and((Orders.employeeId=4 and Orders.customerId=34) or (Orders.employeeId=4 and Orders.customerId=76)) and orderId < 1000000 order by Orders.customerId asc
select({
from: "Orders",
order: {
by: 'Orders.customerId',
type: 'asc' //supprted sort type is - asc,desc
},
join: {
with: "Customers",
type: "left",
on: "Orders.customerId=Customers.customerId",
as: {
customerId: 'cId'
}
},
where: [
{shipperId: 2,},
[{employeeId: 4, customerId: 34}, { or: { employeeId: 4,customerId: 76}}, { orderId: {'<': 100000}}],
]
})
This way of writing can be found, but is this writing correct?
select({
from: "Orders",
order: {
by: 'Orders.customerId',
type: 'asc' //supprted sort type is - asc,desc
},
join: {
with: "Customers",
type: "left",
on: "Orders.customerId=Customers.customerId",
as: {
customerId: 'cId'
}
},
where: [
{shipperId: 2,},
{ orderId: {'<': 100000}},
[{employeeId: 4, customerId: 34}, { or: { employeeId: 4,customerId: 76}}],
]
})
You can find them in a different order
OK, i will have a look.
If you will just change the order of query - it works
select({
from: "Orders",
order: {
by: 'Orders.customerId',
type: 'asc' //supprted sort type is - asc,desc
},
join: {
with: "Customers",
type: "left",
on: "Orders.customerId=Customers.customerId",
as: {
customerId: 'cId'
}
},
where: [{
orderId: {
'<': 1000000
}
}, {
shipperId: 2,
},
[{
employeeId: 4,
customerId: 34,
}, {
or: {
employeeId: 4,
customerId: 76
}
}],
]
})
The above query works but when we will move the <
query at end, it does not work. I will fix this.
fixed in v - 4.6.2, please update and try.
The issue was in promise chain, In longer query while the results was about to evaluate, the engine was returning result to caller.
idbstudio also updated
I hope this issue is fixed. Feel free to reopen if not.
Title
// Add your title here The union query is used with an or query and is used with multiple conditions. The query data is incorrect
Description
// Add your description here The data less than 10000 cannot be queried. If the condition is less than 10000, the query is normal.