Advertisement

03.08.2005 at 11:52AM PST, ID: 21342586
[x]
Attachment Details

SQL Query issue involving multiple JOINS

Asked by mvwmail in ColdFusion Application Server

Tags: , , ,

Hello Folks

Looking for an SQL statement, or should I say an addition to an sql statement I already have working... note I am using Coldfusion MX7 with an Access database

<cfquery name="GetCompanys" datasource="#REQUEST.DS#">
SELECT COMPANY.*, TOWN.TOWNNAME, COUNTY.CountyName
FROM Company LEFT JOIN (Town LEFT JOIN County ON Town.CountyID = County.CountyID) ON Company.TownID = Town.TownID WHERE 0=0

Ignore the where 0=0 bit as I have loads of <CFIF statem,ents after for using this query as a search results generator.

That is by the by.

I am looking to incorporate ANOTHER JOIN into this statement.. as you see the current QUERY is a list of company details, which links to TOWN for town details... and TOWN links to COUNTY, however I want to bring another table into the query CONTACTS

Contacts has a field CompanyID and then an individuals information... there can be more than one contact per company so effectivly including all the above I want another JOIN (not inner as I want NULL matches returned also) ON Company.CompanyID = Contacts.CompanyID

If you wanna rewrite the whole thing, be my guest

Assistance greatly welcome.

ThanksStart Free Trial
 
Loading Advertisement...
 
[+][-]03.08.2005 at 12:23PM PST, ID: 13489910

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.08.2005 at 07:31PM PST, ID: 13492729

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.08.2005 at 07:40PM PST, ID: 13492767

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.10.2005 at 01:23AM PST, ID: 13504178

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.10.2005 at 06:55AM PST, ID: 13506524

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2005 at 07:59AM PST, ID: 13507307

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: ColdFusion Application Server
Tags: multiple, sql, joins, left
Sign Up Now!
Solution Provided By: trailblazzyr55
Participating Experts: 4
Solution Grade: A
 
 
[+][-]03.22.2005 at 09:41AM PST, ID: 13603571

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32