Greetings:
Prelude: We have five tables all sharing a very similar structure (each has
a Customer_ID and Server_ID field for example).
Each table can contain zero to many records with duplicate Server_ID values
allowed.
Need: I need to be able to count the distinct Server_ID's across all of the
tables.
Problems: A customer can have one Server_ID in one table, ten Server_ID's
(some duplicate) in another table and so on. The customer will have the
same Customer_ID in all tables.
I've tried inner joins, left joins, et all to no avail.
The syntax below will only show two Server_ID's for a customer that has
close to 10.
SELECT DISTINCT Application.Server_ID FROM Application LEFT JOIN Content ON
Application.Customer_ID = Content.Customer_ID LEFT JOIN Performance ON
Content.Customer_ID = Performance.Customer_ID LEFT JOIN Ping ON
Performance.Customer_ID = Ping.Customer_ID LEFT JOIN Port ON
Ping.Customer_ID = Port.Customer_ID WHERE Application.Customer_ID = 1 OR
Content.Customer_ID = 1 OR Performance.Customer_ID = 1 OR Ping.Customer_ID
= 1 OR Port.Customer_ID = 1;
What is the correct SQL to get a list of all of the distinct Server_ID's
across the five tables?
Thank you.
________________________________________________
Peter M. Perchansky, Microsoft FrontPage MVP
Dynamic Net, Inc.
Helping companies do business on the Net
420 Park Road; Suite 201
Wyomissing PA 19610
Non-Toll Free: 1-610-736-3795
Personal Email: [EMAIL PROTECTED]
Company Email: [EMAIL PROTECTED]
Web: http://www.dynamicnet.net/
http://www.wemanageservers.com/
________________________________________________