Last active
June 12, 2019 12:54
-
-
Save remcotolsma/fc8e4b3c9b8348f61270a6debd7b70d7 to your computer and use it in GitHub Desktop.
Lookup query Henk.
This file contains 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 | |
t.*, | |
d.* | |
FROM | |
( | |
SELECT | |
`company_code`, | |
`company_name` as `CompanyName`, | |
`period_start_date` as `Begindatum`, | |
`period_end_date` as `Einddatum`, | |
`document_code` as `Type_aangifte`, | |
`status_description` as `Status`, | |
'1c' as `tag_btw_aangifte`, | |
COAlESCE( `supplies_to_countries_within_the_ec`, 0 ) as `3b_omzet`, | |
COALESCE( `value_added_tax_supplies_services_other_rates`, 0 ) as `bedrag` | |
FROM lookup74_wp.wp_lookup_declarations | |
WHERE `vat_return_xbrl` > '' | |
AND `status` = 'active' | |
AND `value_added_tax_supplies_services_other_rates` != 0 | |
AND `company_code` = '1200' | |
AND `period_end_date` = '20190331' | |
) d, | |
( | |
SELECT `office` | |
FROM `wp_lookup_transaction_lines` | |
WHERE office = '1200' | |
GROUP BY `office` | |
) t | |
WHERE | |
d.`company_code` = t.`office` | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment