What is the SOQL query to retrieve last row of table?
SOQL is a bit different than SQL. TOP 1
is not valid in SOQL (Salesforce Object Query Language), you would need to use LIMIT 1
.
Check the documentation: http://www.salesforce.com/us/developer/docs/api/index_CSH.htm#sforce_api_calls_soql_select.htm
You could try this, too:
SELECT Id From ObjectName__c ORDER BY Id DESC LIMIT 1