Created
May 23, 2016 11:35
-
-
Save MPJHorner/014e7f4608df30385cb601c087c06f9d to your computer and use it in GitHub Desktop.
Show Company Contacts & Addresses Report - Khaos Control (Keystone Software)
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 | |
company.company_id, | |
address.address_id, | |
contact.contact_id, | |
company.company_code, | |
company.company_name, | |
address.address1, | |
address.address2, | |
address.locality, | |
address.town, | |
address.county, | |
address.postcode, | |
country.country, | |
country.country2_code, | |
country.country3_code, | |
address.telephone as address_telephone, | |
address.fax as address_fax, | |
address.email as address_email, | |
address_type.short_desc, | |
contact.forename, | |
contact.surname, | |
contact.tel1 as contact_tel1, | |
contact.tel2 as contact_tel2, | |
contact.tel3 as contact_tel3, | |
contact.fax1 as contact_fax1, | |
contact.fax2 as contact_fax2, | |
contact.email as contact_email, | |
contact.pref_invcontact as contact_invoice_preferred, | |
contact.pref_delcontact as contact_delivery_preferred, | |
contact.job_title FROM company | |
LEFT JOIN address | |
ON address.company_id = company.company_id | |
LEFT JOIN address_type | |
ON address.atype_id = address_type.atype_id | |
LEFT JOIN contact | |
ON address.address_id = contact.address_id | |
LEFT JOIN country | |
ON address.country_id = country.country_id | |
WHERE address.inactivate_date = '1899-12-30' | |
ORDER BY | |
company.company_id DESC, | |
address.address_id DESC, | |
contact.contact_id DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment