J
JP
I am running Access 2007.
I have data in about 20 tables that I want to combine together.
This is groundwater sample data from a myriad of sample locations.
The tables are basically formatted as follows:
Location, Depth, SampleDate, [Cmpnd_1], [Cmpnd_1 Qualifer], [Cmpnd_2],
[Cmpnd_2 Qualifier], ..., [Cmpnd_N], [Cmpnd_N Qualfier]
(where Cmpnd_1, Cmpnd_2, ..., Cmpnd_N are actual compound names such as
Acetone or Benzene).
The tables all have different compounds in them.
The number of compounds in each table vary anywhere from 25-50.
My plan was to develop an reverse crosstab query against each table and then
develop a union query to union together all of the reverse crosstab queries.
So far I have only developed 2 reverse crosstab queries.
The reverse crosstab queries work and are structured as follows:
Select Location, Depth, SampleDate, "Cmpnd_1" as Compound, [Cmpnd_1] as
Result, [Cmpnd_1_Qualifier] as Qualifier from Table_1
Union All
Select Location, Depth, SampleDate, "Cmpnd_2" as Compound, [Cmpnd_2] as
Result, [Cmpnd_2_Qualifier] as Qualifier from Table_1
Union All
Select Location, Depth, SampleDate, "Cmpnd_3" as Compound, [Cmpnd_3] as
Result, [Cmpnd_3_Qualifier] as Qualifier from Table_1
....
Union All
Select Location, Depth, SampleDate, "Cmpnd_N" as Compound, [Cmpnd_N] as
Result, [Cmpnd_N_Qualifier] as Qualifier from Table_1;
and
Select Location, Depth, SampleDate, "Cmpnd_1" as Compound, [Cmpnd_1] as
Result, [Cmpnd_1_Qualifier] as Qualifier from Table_2
Union All
Select Location, Depth, SampleDate, "Cmpnd_2" as Compound, [Cmpnd_2] as
Result, [Cmpnd_2_Qualifier] as Qualifier from Table_2
Union All
Select Location, Depth, SampleDate, "Cmpnd_3" as Compound, [Cmpnd_3] as
Result, [Cmpnd_3_Qualifier] as Qualifier from Table_2
....
Union All
Select Location, Depth, SampleDate, "Cmpnd_N" as Compound, [Cmpnd_N] as
Result, [Cmpnd_N_Qualifier] as Qualifier from Table_2;
I also developed the union query to union together those 2 queries.
My union query is structured as follows:
Select Location, Depth, SampleDate, Compound, Result, Qualifier from
Rev_Xtab_Query_1
Union All
Select Location, Depth, SampleDate, Compound, Result, Qualifier from
Rev_Xtab_Query_2;
When I attempt to run the union query I get the error message "Query is too
complex."
I have even tried combining the reverse crosstab queries together in a
single query but get the same error message.
What is "too complex" about this?
Is this just too much "unioning"?
Is the SQL string too long?
Thank you for your help.
I have data in about 20 tables that I want to combine together.
This is groundwater sample data from a myriad of sample locations.
The tables are basically formatted as follows:
Location, Depth, SampleDate, [Cmpnd_1], [Cmpnd_1 Qualifer], [Cmpnd_2],
[Cmpnd_2 Qualifier], ..., [Cmpnd_N], [Cmpnd_N Qualfier]
(where Cmpnd_1, Cmpnd_2, ..., Cmpnd_N are actual compound names such as
Acetone or Benzene).
The tables all have different compounds in them.
The number of compounds in each table vary anywhere from 25-50.
My plan was to develop an reverse crosstab query against each table and then
develop a union query to union together all of the reverse crosstab queries.
So far I have only developed 2 reverse crosstab queries.
The reverse crosstab queries work and are structured as follows:
Select Location, Depth, SampleDate, "Cmpnd_1" as Compound, [Cmpnd_1] as
Result, [Cmpnd_1_Qualifier] as Qualifier from Table_1
Union All
Select Location, Depth, SampleDate, "Cmpnd_2" as Compound, [Cmpnd_2] as
Result, [Cmpnd_2_Qualifier] as Qualifier from Table_1
Union All
Select Location, Depth, SampleDate, "Cmpnd_3" as Compound, [Cmpnd_3] as
Result, [Cmpnd_3_Qualifier] as Qualifier from Table_1
....
Union All
Select Location, Depth, SampleDate, "Cmpnd_N" as Compound, [Cmpnd_N] as
Result, [Cmpnd_N_Qualifier] as Qualifier from Table_1;
and
Select Location, Depth, SampleDate, "Cmpnd_1" as Compound, [Cmpnd_1] as
Result, [Cmpnd_1_Qualifier] as Qualifier from Table_2
Union All
Select Location, Depth, SampleDate, "Cmpnd_2" as Compound, [Cmpnd_2] as
Result, [Cmpnd_2_Qualifier] as Qualifier from Table_2
Union All
Select Location, Depth, SampleDate, "Cmpnd_3" as Compound, [Cmpnd_3] as
Result, [Cmpnd_3_Qualifier] as Qualifier from Table_2
....
Union All
Select Location, Depth, SampleDate, "Cmpnd_N" as Compound, [Cmpnd_N] as
Result, [Cmpnd_N_Qualifier] as Qualifier from Table_2;
I also developed the union query to union together those 2 queries.
My union query is structured as follows:
Select Location, Depth, SampleDate, Compound, Result, Qualifier from
Rev_Xtab_Query_1
Union All
Select Location, Depth, SampleDate, Compound, Result, Qualifier from
Rev_Xtab_Query_2;
When I attempt to run the union query I get the error message "Query is too
complex."
I have even tried combining the reverse crosstab queries together in a
single query but get the same error message.
What is "too complex" about this?
Is this just too much "unioning"?
Is the SQL string too long?
Thank you for your help.