I think you need something along the lines of:

Select fieldlist
FROM company_table INNER JOIN slow_stream ON company_table.Name =
slow_stream.company_name
INNER JOIN medium_stream ON company_table.Name = medium_stream.company_name
INNER JOIN fast_stream ON company_table.Name = fast_stream.company_name

Note that that will only return records if there is a match between all 4
tables.  if you want to return all records from the company_table,
regardless of whether there is a match in the other tables, you'd use:

Select fieldlist
FROM company_table LEFT OUTER JOIN slow_stream ON company_table.Name =
slow_stream.company_name
LEFT OUTER JOIN medium_stream ON company_table.Name =
medium_stream.company_name
LEFT OUTER JOIN fast_stream ON company_table.Name = fast_stream.company_name

HTH,
Bob

-----Original Message-----
From: Darren Adams [mailto:[EMAIL PROTECTED]]
Sent: May 15, 2001 12:09 PM
To: CF-Talk
Subject: SQL Joins.


Hello folks,

I ma having a spot of bother with joining tables in a query and could do
with some advice.

There are 4 tables:  company_table, slow_stream, medium_stream and
fast_stream

Company table holds: company ID, name.

The other tables also have a company_name field.

I want to join all the tables together on the name field to give me one
virtual table.

What is the best way to go about this,  I have tried in a number of ways.

Darren Adams
Web Developer
Marketing Department
Systems Union

Office: 01252 55 6220
Mobile: 07714 817 038
Email: [EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to