Make ynab export equivalent to original export #21

Merged
jacob1123 merged 7 commits from ynab-export-fixes into master 2022-02-25 16:35:18 +01:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit 5bb2c9c8b8 - Show all commits

View File

@ -29,13 +29,13 @@ SELECT transactions.id, transactions.date, transactions.memo,
COALESCE(payees.name, '') as payee, COALESCE(payees.name, '') as payee,
COALESCE(category_groups.name, '') as category_group, COALESCE(category_groups.name, '') as category_group,
COALESCE(categories.name, '') as category, COALESCE(categories.name, '') as category,
( COALESCE((
SELECT CONCAT(otherAccounts.name) SELECT CONCAT(otherAccounts.name)
FROM transactions otherTransactions FROM transactions otherTransactions
LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id
WHERE otherTransactions.group_id = transactions.group_id WHERE otherTransactions.group_id = transactions.group_id
AND otherTransactions.id != transactions.id AND otherTransactions.id != transactions.id
)::text as transfer_account ), '')::text as transfer_account
FROM transactions FROM transactions
INNER JOIN accounts ON accounts.id = transactions.account_id INNER JOIN accounts ON accounts.id = transactions.account_id
LEFT JOIN payees ON payees.id = transactions.payee_id LEFT JOIN payees ON payees.id = transactions.payee_id
@ -51,13 +51,13 @@ SELECT transactions.id, transactions.date, transactions.memo,
COALESCE(payees.name, '') as payee, COALESCE(payees.name, '') as payee,
COALESCE(category_groups.name, '') as category_group, COALESCE(category_groups.name, '') as category_group,
COALESCE(categories.name, '') as category, COALESCE(categories.name, '') as category,
( COALESCE((
SELECT CONCAT(otherAccounts.name) SELECT CONCAT(otherAccounts.name)
FROM transactions otherTransactions FROM transactions otherTransactions
LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id
WHERE otherTransactions.group_id = transactions.group_id WHERE otherTransactions.group_id = transactions.group_id
AND otherTransactions.id != transactions.id AND otherTransactions.id != transactions.id
)::text as transfer_account ), '')::text as transfer_account
FROM transactions FROM transactions
INNER JOIN accounts ON accounts.id = transactions.account_id INNER JOIN accounts ON accounts.id = transactions.account_id
LEFT JOIN payees ON payees.id = transactions.payee_id LEFT JOIN payees ON payees.id = transactions.payee_id

View File

@ -87,13 +87,13 @@ SELECT transactions.id, transactions.date, transactions.memo,
COALESCE(payees.name, '') as payee, COALESCE(payees.name, '') as payee,
COALESCE(category_groups.name, '') as category_group, COALESCE(category_groups.name, '') as category_group,
COALESCE(categories.name, '') as category, COALESCE(categories.name, '') as category,
( COALESCE((
SELECT CONCAT(otherAccounts.name) SELECT CONCAT(otherAccounts.name)
FROM transactions otherTransactions FROM transactions otherTransactions
LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id
WHERE otherTransactions.group_id = transactions.group_id WHERE otherTransactions.group_id = transactions.group_id
AND otherTransactions.id != transactions.id AND otherTransactions.id != transactions.id
)::text as transfer_account ), '')::text as transfer_account
FROM transactions FROM transactions
INNER JOIN accounts ON accounts.id = transactions.account_id INNER JOIN accounts ON accounts.id = transactions.account_id
LEFT JOIN payees ON payees.id = transactions.payee_id LEFT JOIN payees ON payees.id = transactions.payee_id
@ -215,13 +215,13 @@ SELECT transactions.id, transactions.date, transactions.memo,
COALESCE(payees.name, '') as payee, COALESCE(payees.name, '') as payee,
COALESCE(category_groups.name, '') as category_group, COALESCE(category_groups.name, '') as category_group,
COALESCE(categories.name, '') as category, COALESCE(categories.name, '') as category,
( COALESCE((
SELECT CONCAT(otherAccounts.name) SELECT CONCAT(otherAccounts.name)
FROM transactions otherTransactions FROM transactions otherTransactions
LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id LEFT JOIN accounts otherAccounts ON otherAccounts.id = otherTransactions.account_id
WHERE otherTransactions.group_id = transactions.group_id WHERE otherTransactions.group_id = transactions.group_id
AND otherTransactions.id != transactions.id AND otherTransactions.id != transactions.id
)::text as transfer_account ), '')::text as transfer_account
FROM transactions FROM transactions
INNER JOIN accounts ON accounts.id = transactions.account_id INNER JOIN accounts ON accounts.id = transactions.account_id
LEFT JOIN payees ON payees.id = transactions.payee_id LEFT JOIN payees ON payees.id = transactions.payee_id