SQL Error - db_pagination

WITH ctm_table AS ( SELECT news_id, news_publishdate, news_title, news_subtitle, ( SELECT rtrim(gallery_path) + '/' + rtrim(gallery_name) FROM gbinder join gallery on gallery_id = gbinder_galleryid and gallery_width = '' and gallery_height = '' WHERE gbinder_table = 'news' and gbinder_tableid = news_id ) as thumb, row_number() OVER ( ORDER BY ) as tbl_rownum FROM news WHERE news_projectid = ? and news_key = ? and news_show = ? ) SELECT count(*) as total_records FROM ctm_table

Array ( [0] => Array ( [0] => 07002 [SQLSTATE] => 07002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver 17 for SQL Server]COUNT field incorrect or syntax error [message] => [Microsoft][ODBC Driver 17 for SQL Server]COUNT field incorrect or syntax error ) )