Use date_trunc instead of splitting date into year and month
This commit is contained in:
@ -64,7 +64,7 @@ func (q *Queries) DeleteAllTransactions(ctx context.Context, budgetID uuid.UUID)
|
||||
}
|
||||
|
||||
const getTransactionsByMonthAndCategory = `-- name: GetTransactionsByMonthAndCategory :many
|
||||
SELECT year, month, category_id, budget_id, amount
|
||||
SELECT date, category_id, budget_id, amount
|
||||
FROM transactions_by_month
|
||||
WHERE transactions_by_month.budget_id = $1
|
||||
`
|
||||
@ -79,8 +79,7 @@ func (q *Queries) GetTransactionsByMonthAndCategory(ctx context.Context, budgetI
|
||||
for rows.Next() {
|
||||
var i TransactionsByMonth
|
||||
if err := rows.Scan(
|
||||
&i.Year,
|
||||
&i.Month,
|
||||
&i.Date,
|
||||
&i.CategoryID,
|
||||
&i.BudgetID,
|
||||
&i.Amount,
|
||||
|
Reference in New Issue
Block a user