INSERT INTO billing (team_id, credit_change, credits, type)
SELECT teams.id, billing.credit_change, teams.credits + billing.credit_change, 'runtime'
FROM teams
JOIN (
VALUES
(1, 100),
(2, 200),
(3, 150)
) AS billing(team_id, credit_change)
ON teams.id = billing.team_id;
INSERT INTO billing (team_id, credit_change, credits, type)
SELECT teams.id, billing.credit_change, teams.credits + billing.credit_change, 'runtime'
FROM teams
JOIN (
VALUES
(1, 100),
(2, 200),
(3, 150)
) AS billing(team_id, credit_change)
ON teams.id = billing.team_id;