You need to sign in to do that
Don't have an account?
dev_jh
Simple question about SOQL statement
Hi all,
I am not very familiar with SOQL yet. I want a query that returns the Maximum value for an autonumber field on a custom object. On ANSI SQL I would use MAX but it doesn´t seem to be available in SOQL. I can see that the below statement provides me with the result I want but not sure if it is optimal (it doesn´t look great):
SELECT Name FROM X__c ORDER BY Name DESC LIMIT 1
Any suggestions?
Thanks,
J
I am not very familiar with SOQL yet. I want a query that returns the Maximum value for an autonumber field on a custom object. On ANSI SQL I would use MAX but it doesn´t seem to be available in SOQL. I can see that the below statement provides me with the result I want but not sure if it is optimal (it doesn´t look great):
SELECT Name FROM X__c ORDER BY Name DESC LIMIT 1
Any suggestions?
Thanks,
J
Hi dev_jh,
I think, right now there are no better options to get the MAX value, because there are no aggregate functions available.
Best, Peter