You have chosen to sponsor your bid up to a maximum amount of .
I need a stored procedure (in PLPgsql or SQL) or a pure SQL statement. The database schema is:
DROP TABLE IF EXISTS receipts;
CREATE TABLE receipts (
id SERIAL PRIMARY KEY,
amount NUMERIC(20, 2) DEFAULT 0.00
DROP TABLE IF EXISTS bank_transactions;
CREATE TABLE bank_transactions (
id serial NOT NULL,
amount NUMERIC(20, 2)
The point of your procedure is to match any group of bank_transactions to any group of receipts or the other way around, so that the sum of the amount in a group equals the sum of the amount in the other group. For example the following two rows in receipts table will match a row in transactions with the amount 20.00:
One or more rows in receipts may match the sum of one or more rows in transactions, and the other way around. The output of your query or stored procedure should be in the following format:
array of ints of matching receipt ids array of ints of matching transaction ids
[1, 3, 8] [2,3,8]
The example data above means that the sum of receipts with ids 1, 3 and 8 match the sum of the transactions with ids 2, 3 and 8. Please use the array data type for this.
The price for this project is 20$ and the deadline is 2 days.
Please provide your GitHub.com username in your bid.