If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Linking Problem
I have a database with 12 tables. I want to do a simple query where I would
get the count of three different tables. Count(TableA) Count(TableB) Count(TableC) All three tables have the same primary key. The query fuctions when I only deal with 2 tables. But when I deal with more than that I get this error: The SQL statement could not be executed becuase it contains ambiguous outer joins. To force one of the joins to performed first, create a separate query that performs the first join and then include that query in your SQL statement. Any idea what I'm doing wrong. Thanks. |
#2
|
|||
|
|||
Linking Problem
Can not know based on the information provided.
Why did you not post the SQL statement as you knew from the error message it had a problem? -- KARL DEWEY Build a little - Test a little "Chinny03" wrote: I have a database with 12 tables. I want to do a simple query where I would get the count of three different tables. Count(TableA) Count(TableB) Count(TableC) All three tables have the same primary key. The query fuctions when I only deal with 2 tables. But when I deal with more than that I get this error: The SQL statement could not be executed becuase it contains ambiguous outer joins. To force one of the joins to performed first, create a separate query that performs the first join and then include that query in your SQL statement. Any idea what I'm doing wrong. Thanks. |
#3
|
|||
|
|||
Linking Problem
On Jun 11, 6:28 pm, Chinny03
wrote: I have a database with 12 tables. I want to do a simple query where I would get the count of three different tables. Count(TableA) Count(TableB) Count(TableC) All three tables have the same primary key. The hard way (a.k.a. roll your own): SELECT COUNT(ID) AS CARDINALITY, 'TableA' AS TABLE_NAME FROM TableA UNION ALL SELECT COUNT(ID), 'TableB' FROM TableB UNION ALL SELECT COUNT(ID), 'TableC' FROM TableC; An easier way: use the SCHEMA_CATALOG (a.k.a don't reinvent the wheel): Set rs = CurrentProject.Connection.OpenSchema(adSchemaStati stics) rs.Filter = "TABLE_NAME = 'TableA' OR TABLE_NAME = 'TableB' OR TABLE_NAME = 'TableC'" ? rs.GetString TableA 1 TableB 3 TableC 0 Jamie. -- |
Thread Tools | |
Display Modes | |
|
|