Select company_ID, company_name, contact_company_FK, contact_name >From companies LEFT OUTER JOIN Contacts ON company_ID = contact_company_FK
Or RIGHT -e -----Original Message----- From: Ray Champagne [mailto:[EMAIL PROTECTED] Sent: Monday, December 20, 2004 12:23 PM To: CF-Talk Subject: database query I have two tables in my DB: Companies: company_ID (PK) company_name etc Contacts: contact_company_FK (FK linked to company_ID) contact_name etc What I need to do is query the DB and get all the companies and all the contacts associated with that company, even if there are no contacts for a particular company. I am passing in the #company_ID# to the page. I think what I am supposed to be doing is a LEFT JOIN, but I can't get the syntax to work correctly. Anybody got any ideas for this? I am using the evil MS Access DB and CFMX 6.1. Thanks! Ray ============================================= Ray Champagne - Senior Application Developer CrystalVision Web Site Design and Internet Services 603.433.9559 www.crystalvision.org ============================================= The information contained in this transmission (including any attached files) is CONFIDENTIAL and is intended only for the person(s) named above. If you received this transmission in error, please delete it from your system and notify us immediately. If you are not an intended recipient, please note that any use or dissemination of the information contained in this transmission (including any attached files) and the copying, printing, or retransmission of that information is strictly prohibited. You can notify us by return email or by phone at 603.433.9559. Thank you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188281 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54