balance view

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stellar Meta

Q&A about the site for developers and users of Stellar and the Stellar Distributed Exchange

CREATE TABLE #payment(
   id      VARCHAR(11) NOT NULL 
  ,month   DATE  NOT NULL
  ,balance INTEGER  NOT NULL
);
INSERT INTO #payment(id,month,balance) VALUES ('0009gmail','2016-01-01',2000);
INSERT INTO #payment(id,month,balance) VALUES ('0009gmail','2016-02-01',3500);
INSERT INTO #payment(id,month,balance) VALUES ('0009gmail','2016-03-01',800);
INSERT INTO #payment(id,month,balance) VALUES ('0009gmail','2016-04-01',1400);
INSERT INTO #payment(id,month,balance) VALUES ('0009gmail','2016-05-01',-500);
INSERT INTO #payment(id,month,balance) VALUES ('0019gmail','2016-05-01',-500);

SELECT id, SUM(balance) AS balance
FROM #payment
GROUP BY id;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results