Debit Credit Balance calculating from previous records with Pagination MYSQL
As you are using the user-defined variables to iterate and so calculating the balnace, you have to set the initial variable ti the right amount


SET @variable = 0;
SELECT
-SUM(debit)  + SUM(credit) INTO @variable
FROM billing_ledger where date &lt; '2021-01-01';
SELECT id, date, particulars, debit, credit
, @variable := @variable + (COALESCE(`credit`,0) - COALESCE(`debit`,0)) `balance` 
FROM billing_ledger where date &gt;= '2021-01-01' ORDER BY id asc ;


✓

✓

 id | date       | particulars           | debit | credit | balance
--: | :--------- | :-------------------- | ----: | -----: | ------:
112 | 2021-01-01 | Purchased Item: Eggs  |   200 |   null |    2700
113 | 2021-01-02 | Purchased Item: Onion |  2300 |   null |     400