1. A computer-implemented method comprising: receiving a query at a server, the query including: a selected record, an outer join that provides a joined table having NULLable records, and an Order By clause that provides a sort order for ordering records in the joined table based on one or more fields of the joined table; and generating, by the server, a separate query configured to fetch from the joined table a current row that corresponds to the selected record and either subsequent rows or previous rows relative to the current row, wherein generating the separate query comprises: determining whether a paging direction of the separate query is forward paging or backward paging, determining whether the sort order for the Order By clause is ascending or descending, determining an original inequality operator based on the sort order for the Order By clause and the paging direction of the separate query, determining whether the current row returns a NULL value, and generating a WHERE condition for the separate query configured to either change the original inequality operator or ignore the original inequality operator depending on whether the paging direction of the separate query is forward paging or backward paging, whether the sort order of the Order By clause is ascending or descending, and whether the current row returns a NULL value.