Created
September 3, 2021 20:42
-
-
Save ofelix03/14e53348ce1833f9a0bab7489b2bdb29 to your computer and use it in GitHub Desktop.
Example: Table joins with WHERE clause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT ie.name "invoice_number", | |
| pj.name "payment_journal", | |
| apr.amount "reconciliation_amount" | |
| FROM account_move_line iel, --- invoice entry line | |
| account_move ie, --- invoice entry | |
| account_partial_reconcile apr, --- partial payment | |
| account_move_line pel, --- payment entry line | |
| account_move pe, --- payment entry | |
| account_journal pj --- journal | |
| WHERE | |
| --- table joins | |
| iel.move_id = ie.id | |
| AND apr.debit_move_id = iel.id | |
| AND apr.credit_move_id = pel.id | |
| AND pel.move_id = pe.id | |
| AND pj.id = pel.journal_id | |
| --- row filters | |
| AND ie.move_type = 'out_invoice' | |
| AND iel.analytic_account_id = 2443 | |
| AND ie.name = 'INV/2021/2344' | |
| ORDER BY ie.name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment