18 lines
516 B
SQL
18 lines
516 B
SQL
-- name: CreateTransaction :one
|
|
INSERT INTO transactions
|
|
(date, memo, amount, account_id, payee_id)
|
|
VALUES ($1, $2, $3, $4, $5)
|
|
RETURNING *;
|
|
|
|
-- name: GetTransactionsForBudget :many
|
|
SELECT transactions.* FROM transactions
|
|
LEFT JOIN accounts ON accounts.id = transactions.account_id
|
|
WHERE accounts.budget_id = $1
|
|
ORDER BY transactions.date DESC
|
|
LIMIT 200;
|
|
|
|
-- name: GetTransactionsForAccount :many
|
|
SELECT transactions.* FROM transactions
|
|
WHERE transactions.account_id = $1
|
|
ORDER BY transactions.date DESC
|
|
LIMIT 200; |