PostgreSQL: Create SQL statement/stored procedure

  • Status Closed
  • Budget $8 - $15 USD / hour
  • Total Bids 1

Project Description

I need a stored procedure (in PLPgsql or SQL) or a pure SQL statement. The database schema is:


CREATE TABLE receipts (


entry_date DATE,

amount NUMERIC(20, 2) DEFAULT [url removed, login to view]


DROP TABLE IF EXISTS bank_transactions;

CREATE TABLE bank_transactions (

id serial NOT NULL,

transaction_date DATE,

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 [url removed, login to view]:

[url removed, login to view]

[url removed, login to view]

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 [url removed, login to view] username in your bid.

Get free quotes for a project like this
Awarded to:
Skills Required

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online