Change the query for custom dashlet pagination

How do I change the pagination query for a custom dashlet?

This is my code for displaying the records inside the dashlet


$lvsParams = array(
            'custom_select' => '  , SUM(total_amount) as total_amt, billing_account_id, status', 
            'custom_where'  => ' AND (status = "Paid" OR status = "Partial" OR status = "Pending" OR status = "Unpaid") AND billing_account_id IS NOT NULL GROUP BY billing_account_id HAVING total_amt > 10000',
        );

I know this works since the records are displayed in my dashlet but I still get an error because the pagination query didn’t include my custom_select thus giving me this error: MySQL error 1054: Unknown column ‘total_amt’ in ‘having clause’