My Dependencies for moor:
moor_flutter: ^2.1.1
moor_ffi: ^0.4.0
I have the tables:
I want all netPoints that match the "PARENTS_ID" s. below.
My problem is that I cannot access netPointNetPoint in the Where condition.
select(netPoint)
..where((t) => t.TYPE.equals(type))
..join(
[
innerJoin(netPointNetPoint, netPointNetPoint.CHILDREN_ID.equalsExp(netPoint.ID)),
innerJoin(netPointNetPoint, netPointNetPoint.PARENTS_ID.equals(parentId))
]
)
).get();
Unfortunately the help page https://moor.simonbinder.eu/docs/advanced-features/joins/ did not help me.
Well, the questions is quite old, but I've faced the same problem and just in case some one will have the same problem. I guess you had to change the expressions with something like this:
select(netPoint)
..where((t) => t.TYPE.equals(type))
..where((t) => netPointNetPoint.PARENTS_ID.equals(parentId))
..join(
[
innerJoin(netPointNetPoint, netPointNetPoint.CHILDREN_ID.equalsExp(netPoint.ID))
]
)).get();
The join's result will have all the columns you need, hence you just need to check that the column in the row has needed value. E.g. netPointNetPoint.PARENTS_ID.equals(parentId).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With