+ Start a Discussion
Peter KayePeter 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:
    $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 !
Best Answer chosen by Peter Kaye

All Answers

This was selected as the best answer
Peter KayePeter Kaye
Hi Patcs_1 - Just what I needed.  Thanks.