You need to sign in to do that
Don't have an account?
Peter Kaye
SOQL equivalent of MySQL LIMIT
Is there any way I can achieve the functionality of MySQL LIMIT with SOQL ? For example to replicate the current code:
Any thoughts or advice on this very welcome !
$rs = mysql_query("select count(*) from users"); $row = mysql_fetch_row($rs); $result["total"] = $row[0]; $rs = mysql_query("select * from users limit $offset,$rows"); $items = array(); while($row = mysql_fetch_object($rs)){ array_push($items, $row); } $result["rows"] = $items; echo json_encode($result);The bit I need help with is the SQL "select * from users limit $offset,$rows" . $offset and $rows are parameters which represent a selection of the returned records - say your SOQL without the parameters returns 2K records you could then generate JSON for records 200 to 500 , 500 to 700 etc and pass these into a javascript data grid.
Any thoughts or advice on this very welcome !
Hope the below link would be helpful.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_offset.htm
Thanks
All Answers
Hope the below link would be helpful.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_offset.htm
Thanks