How do I count the number of messages where my body length is between 0 and 25 characters long?
Message.countBy('from Message m where m.body.length <= 25')
Unfortunately for me, countBy
does not take a string parameter.
How do I count the number of messages where my body length is between 0 and 25 characters long?
Message.countBy('from Message m where m.body.length <= 25')
Unfortunately for me, countBy
does not take a string parameter.
Looking at the dynamic method reference, the best you can probably do is use executeQuery
instead of count*
:
Message.executeQuery('select count(m) from Message m where SIZE(m.body) < 25')
EDIT: Here are a couple of links that might help with writing/executing the query: