Skip to content

Commit

Permalink
don't use GROUP as alias in MySQL query
Browse files Browse the repository at this point in the history
  • Loading branch information
individual-it committed May 11, 2020
1 parent 78cacf7 commit f835e99
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions server/controllers/finance/accounts/transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ async function getAccountTransactions(options, openingBalance = 0) {
// the running balance can only be in the enterprise currency. It doesn't
// make sense to have the running balance in any other currency.
const sql = `
SELECT groups.trans_id, groups.debit, groups.credit, groups.debit_equiv,
groups.credit_equiv, groups.trans_date, groups.document_reference,
groups.exchangedCredit, groups.exchangedDebit, groups.exchangedBalance,
groups.rate, ROUND(groups.invertedRate, 2) AS invertedRate, groups.cumsum,
groups.description, groups.currency_id, groups.posted, created_at, transaction_type_id
FROM (${query})c, (SELECT @cumsum := ${openingBalance || 0})z) AS groups
SELECT bhima_groups.trans_id, bhima_groups.debit, bhima_groups.credit, bhima_groups.debit_equiv,
bhima_groups.credit_equiv, bhima_groups.trans_date, bhima_groups.document_reference,
bhima_groups.exchangedCredit, bhima_groups.exchangedDebit, bhima_groups.exchangedBalance,
bhima_groups.rate, ROUND(bhima_groups.invertedRate, 2) AS invertedRate, bhima_groups.cumsum,
bhima_groups.description, bhima_groups.currency_id, bhima_groups.posted, created_at, transaction_type_id
FROM (${query})c, (SELECT @cumsum := ${openingBalance || 0})z) AS bhima_groups
`;

const { totalsQuery, totalsParameters } = getTotalsSQL(options);
Expand Down

0 comments on commit f835e99

Please sign in to comment.