balance view

0

Please login or register to vote for this query.

(click on this box to dismiss)

Genealogy and Family History Meta

Q&A about the site for expert genealogists and people interested in genealogy or family history

CREATE TABLE #account
(
    id                 integer                 NOT NULL PRIMARY KEY,
    name               varchar(64)               NOT NULL,
    address            varchar(42)               NOT NULL,
    symbol             varchar(10)               NOT NULL,
    network            varchar(10)               NOT NULL,
    type               varchar(100)  NOT NULL,
);

CREATE TABLE #balance
(
    id                 integer                NOT NULL PRIMARY KEY,
    account_id         integer REFERENCES #account (id) NOT NULL,
    amount             bigint                   NOT NULL,
    currency_type      varchar  NOT NULL,
    balance_type       varchar NOT NULL,
    network            varchar(10)              NOT NULL,
);

INSERT INTO #account(id,name,address,symbol,network,type) VALUES (1,'test','test','test','test','test');
/*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);
*/
-- aggregated view of the sum of all account balances per account id
-- SELECT account_id, sum(amount) from balance GROUP BY account_id;

Enter Parameters

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