I’m struggeling on another quite simple query. If I have nodes with an field property within and I want to find the ones having the most elements in their field. How do I do that?
select name, myfield.size() from mynode where myfield.size() = ( select max(myfield.size()) from mynode)
That’s not working. Subquery is working fine if used alone and query is working fine if I leave out the where part and use it alone. It also works fine if I put a fix number instead of the subquery behind, but that’s not what I want. Also Order by and Limit is not an option if you have multiple nodes with the same amount of field elements it cuts out the others.
Also I tried to solve it with Let:
select name, myfield.size() from mynode let $max = ( select max(myfield.size()) from mynode) where myfield.size() = $max
But that’s not working either. I don’t get why that’s not working. I’m using Version 3.0.8 and the Studio.
Would be glad if someone could tell me how to do that correctly. Thank you so much!