Updated getSelectCountSql method to be used only with sales_order controller