SELECT sum(diff)
FROM transactions t
    JOIN accounts a ON t.aid = a.aid
WHERE tid > 100000 and tid < 101000;
