Grid application column sort

I have lots of grid applications, but one is a grid application for a table with > 2 million records.

Column sorting works well on every grid app except that grid application with lots of records. Attempting to sort using the column header pops up an error message indicating that the SQL that SC generates to sort is wrong.

Because it’s one of those popup HTML error dialogs, it’s difficult to be sure, but it’s probably that comma “,” between the order by and the limit.

MySQL hates extraneous commas…

How do I fix this? Why does SC generate a comma for one ORDER BY clause?

The error:

<hr />
(pdo-mysql): SELECT Visit_Date, Meter_Number, Last_Visit_Days, Chem_1, Orifice_Plate, Differential, Pressure, Chem_1_Qty, Chem_2, Chem_2_Qty, Comments, Latitude, Longitude, _id from T_Visit order by Visit_Date desc, LIMIT 0,22 &nbsp;
<hr />

1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘LIMIT 0,22’ at line 1<br>