Pagination Issues with SQL Server

I am having a problem with getting pagination to work. If I look at the results for the original query, it works fine. When I click on one of the pages, I get an error. I added “?offset=5” to the query and I see the following error:

{“code”:“42000”,“file”:“C:\Websites\GraphicsXchange\dmxConnectLib\lib\db\Connection.php”,“line”:108,“message”:“SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near the keyword ‘AS’.”,“trace”:"#0 C:\Websites\GraphicsXchange\dmxConnectLib\lib\db\Connection.php(108): PDOStatement->execute()\n#1 C:\Websites\GraphicsXchange\dmxConnectLib\modules\dbconnector.php(197): lib\db\Connection->execute(‘SELECT * FROM (…’, Array)\n#2 C:\Websites\GraphicsXchange\dmxConnectLib\lib\App.php(173): modules\dbconnector->paged(Object(stdClass), ‘getads’)\n#3 C:\Websites\GraphicsXchange\dmxConnectLib\lib\App.php(137): lib\App->execSteps(Object(stdClass))\n#4 C:\Websites\GraphicsXchange\dmxConnectLib\lib\App.php(107): lib\App->execSteps(Array)\n#5 C:\Websites\GraphicsXchange\dmxConnectLib\lib\App.php(72): lib\App->exec(Object(stdClass))\n#6 C:\Websites\GraphicsXchange\dmxConnect\api\get_ads.php(8): lib\App->define(Object(stdClass))\n#7 {main}"}

Is this a bug or am I doing something wrong?

I recreated a simple page that you can view:


Update: migrated db to mysql and it worked using mysql instead of MS SQL Server.

What database server did you have the error on, which version of MS SQL Server?

Using SQL Server Express 13.0.4001