P
Penny
I converting my database from 97 to 2003 and now my union queries don't work.
Can you tell me why? The below is the message I get. Thanks in advance for
any help.
"This expression is typed incorrectly, or it is to complex to be evaluated.
For example, a numeric expressoin may contain to many complicated elements.
Try simplifying the expression by assigning parts of the expression to
variables."
This is my code:
SELECT [Test 1].[Customer Name], [Test 1].[Relationship Manager], [Test
1].[Line of Business], [Test 1].[Division Head Last Name Only], [Test
1].[Real Estate Market], [Test 1].[Year],Null AS DerivativeFees1, Null AS
AgencyFee2, Null AS IncrementalFeeIncome3, Null AS GrandTotals4,Null AS
SubDebt5
FROM [Test 1]
Union
SELECT qrySumOfDerivativeFeesDivisionHeadRE.[Customer Name],
qrySumOfDerivativeFeesDivisionHeadRE.[Relationship Manager],
qrySumOfDerivativeFeesDivisionHeadRE.[Line of Business],
qrySumOfDerivativeFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfDerivativeFeesDivisionHeadRE.[Real Estate Market],
qrySumOfDerivativeFeesDivisionHeadRE.[Year],Sum(qrySumOfDerivativeFeesDivisionHeadRE.NPV)
AS DerivativeFees1, Null AS AgencyFee2, Null AS IncrementalFeeIncome3, Null
AS GrandTotals4,Null AS SubDebt5
FROM qrySumOfDerivativeFeesDivisionHeadRE
GROUP BY qrySumOfDerivativeFeesDivisionHeadRE.[Customer Name],
qrySumOfDerivativeFeesDivisionHeadRE.[Relationship Manager],
qrySumOfDerivativeFeesDivisionHeadRE.[Line of Business],
qrySumOfDerivativeFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfDerivativeFeesDivisionHeadRE.[Real Estate Market],
qrySumOfDerivativeFeesDivisionHeadRE.[Year],Null, Null, Null,Null
Union
SELECT qrySumOfAgencyFeesDivisionHeadRE.[Customer Name],
qrySumOfAgencyFeesDivisionHeadRE.[Relationship Manager],
qrySumOfAgencyFeesDivisionHeadRE.[Line of Business],
qrySumOfAgencyFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfAgencyFeesDivisionHeadRE.[Real Estate Market],
qrySumOfAgencyFeesDivisionHeadRE.[Year],Null AS DerivativeFees1, Sum([Agency
Fee]) AS AgencyFee2, Null AS IncrementalFeeIncome3, Null AS GrandTotals4,Null
AS SubDebt5
FROM qrySumOfAgencyFeesDivisionHeadRE
GROUP BY qrySumOfAgencyFeesDivisionHeadRE.[Customer Name],
qrySumOfAgencyFeesDivisionHeadRE.[Relationship Manager],
qrySumOfAgencyFeesDivisionHeadRE.[Line of Business],
qrySumOfAgencyFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfAgencyFeesDivisionHeadRE.[Real Estate Market],
qrySumOfAgencyFeesDivisionHeadRE.[Year],Null, Null, Null,Null
Union
SELECT qrySumOfSyndicationFeesDivisionHeadRE.[Customer Name],
qrySumOfSyndicationFeesDivisionHeadRE.[Relationship Manager],
qrySumOfSyndicationFeesDivisionHeadRE.[Line of Business],
qrySumOfSyndicationFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSyndicationFeesDivisionHeadRE.[Real Estate Market],
qrySumOfSyndicationFeesDivisionHeadRE.[Year],Null AS DerivativeFees1, Null AS
AgencyFee2, Sum(qrySumOfSyndicationFeesDivisionHeadRE.[Incremental fee
income]) AS IncrementalFeeIncome3, Null AS GrandTotals4,Null AS SubDebt5
FROM qrySumOfSyndicationFeesDivisionHeadRE
GROUP BY qrySumOfSyndicationFeesDivisionHeadRE.[Customer Name],
qrySumOfSyndicationFeesDivisionHeadRE.[Relationship Manager],
qrySumOfSyndicationFeesDivisionHeadRE.[Line of Business],
qrySumOfSyndicationFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSyndicationFeesDivisionHeadRE.[Real Estate Market],
qrySumOfSyndicationFeesDivisionHeadRE.[Year], Null, Null, Null,Null
UNION SELECT qrySumOfOtherFeesDivisionHeadRE.[Customer Name],
qrySumOfOtherFeesDivisionHeadRE.[Relationship Manager],
qrySumOfOtherFeesDivisionHeadRE.[Line of Business],
qrySumOfOtherFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfOtherFeesDivisionHeadRE.[Real Estate Market],
qrySumOfOtherFeesDivisionHeadRE.[Year], Null AS DerivativeFees1, Null AS
AgencyFee2, Null AS IncrementalFeeIncome3,
Sum(qrySumOfOtherFeesDivisionHeadRE.[Grand Total]) AS GrandTotals4,Null AS
SubDebt5
FROM qrySumOfOtherFeesDivisionHeadRE
GROUP BY qrySumOfOtherFeesDivisionHeadRE.[Customer Name],
qrySumOfOtherFeesDivisionHeadRE.[Relationship Manager],
qrySumOfOtherFeesDivisionHeadRE.[Line of Business],
qrySumOfOtherFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfOtherFeesDivisionHeadRE.[Real Estate Market],
qrySumOfOtherFeesDivisionHeadRE.[Year], Null, Null, Null,Null
UNION SELECT qrySumOfSubDebtRevenueDivisionHeadRE.[Customer Name],
qrySumOfSubDebtRevenueDivisionHeadRE.[Relationship Manager],
qrySumOfSubDebtRevenueDivisionHeadRE.[Line Of Business],
qrySumOfSubDebtRevenueDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSubDebtRevenueDivisionHeadRE.[Real Estate
Market],qrySumOfSubDebtRevenueDivisionHeadRE.[Year],Null AS DerivativeFees1,
Null AS AgencyFee2, Null AS IncrementalFeeIncome3, Null AS
GrandTotals4,Sum(qrySumOfSubDebtRevenueDivisionHeadRE.[SubDebt]) AS SubDebt5
FROM qrySumOfSubDebtRevenueDivisionHeadRE
GROUP BY qrySumOfSubDebtRevenueDivisionHeadRE.[Customer Name],
qrySumOfSubDebtRevenueDivisionHeadRE.[Relationship Manager],
qrySumOfSubDebtRevenueDivisionHeadRE.[Line Of Business],
qrySumOfSubDebtRevenueDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSubDebtRevenueDivisionHeadRE.[Real Estate
Market],qrySumOfSubDebtRevenueDivisionHeadRE.[Year],Null, Null, Null,Null;
Can you tell me why? The below is the message I get. Thanks in advance for
any help.
"This expression is typed incorrectly, or it is to complex to be evaluated.
For example, a numeric expressoin may contain to many complicated elements.
Try simplifying the expression by assigning parts of the expression to
variables."
This is my code:
SELECT [Test 1].[Customer Name], [Test 1].[Relationship Manager], [Test
1].[Line of Business], [Test 1].[Division Head Last Name Only], [Test
1].[Real Estate Market], [Test 1].[Year],Null AS DerivativeFees1, Null AS
AgencyFee2, Null AS IncrementalFeeIncome3, Null AS GrandTotals4,Null AS
SubDebt5
FROM [Test 1]
Union
SELECT qrySumOfDerivativeFeesDivisionHeadRE.[Customer Name],
qrySumOfDerivativeFeesDivisionHeadRE.[Relationship Manager],
qrySumOfDerivativeFeesDivisionHeadRE.[Line of Business],
qrySumOfDerivativeFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfDerivativeFeesDivisionHeadRE.[Real Estate Market],
qrySumOfDerivativeFeesDivisionHeadRE.[Year],Sum(qrySumOfDerivativeFeesDivisionHeadRE.NPV)
AS DerivativeFees1, Null AS AgencyFee2, Null AS IncrementalFeeIncome3, Null
AS GrandTotals4,Null AS SubDebt5
FROM qrySumOfDerivativeFeesDivisionHeadRE
GROUP BY qrySumOfDerivativeFeesDivisionHeadRE.[Customer Name],
qrySumOfDerivativeFeesDivisionHeadRE.[Relationship Manager],
qrySumOfDerivativeFeesDivisionHeadRE.[Line of Business],
qrySumOfDerivativeFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfDerivativeFeesDivisionHeadRE.[Real Estate Market],
qrySumOfDerivativeFeesDivisionHeadRE.[Year],Null, Null, Null,Null
Union
SELECT qrySumOfAgencyFeesDivisionHeadRE.[Customer Name],
qrySumOfAgencyFeesDivisionHeadRE.[Relationship Manager],
qrySumOfAgencyFeesDivisionHeadRE.[Line of Business],
qrySumOfAgencyFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfAgencyFeesDivisionHeadRE.[Real Estate Market],
qrySumOfAgencyFeesDivisionHeadRE.[Year],Null AS DerivativeFees1, Sum([Agency
Fee]) AS AgencyFee2, Null AS IncrementalFeeIncome3, Null AS GrandTotals4,Null
AS SubDebt5
FROM qrySumOfAgencyFeesDivisionHeadRE
GROUP BY qrySumOfAgencyFeesDivisionHeadRE.[Customer Name],
qrySumOfAgencyFeesDivisionHeadRE.[Relationship Manager],
qrySumOfAgencyFeesDivisionHeadRE.[Line of Business],
qrySumOfAgencyFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfAgencyFeesDivisionHeadRE.[Real Estate Market],
qrySumOfAgencyFeesDivisionHeadRE.[Year],Null, Null, Null,Null
Union
SELECT qrySumOfSyndicationFeesDivisionHeadRE.[Customer Name],
qrySumOfSyndicationFeesDivisionHeadRE.[Relationship Manager],
qrySumOfSyndicationFeesDivisionHeadRE.[Line of Business],
qrySumOfSyndicationFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSyndicationFeesDivisionHeadRE.[Real Estate Market],
qrySumOfSyndicationFeesDivisionHeadRE.[Year],Null AS DerivativeFees1, Null AS
AgencyFee2, Sum(qrySumOfSyndicationFeesDivisionHeadRE.[Incremental fee
income]) AS IncrementalFeeIncome3, Null AS GrandTotals4,Null AS SubDebt5
FROM qrySumOfSyndicationFeesDivisionHeadRE
GROUP BY qrySumOfSyndicationFeesDivisionHeadRE.[Customer Name],
qrySumOfSyndicationFeesDivisionHeadRE.[Relationship Manager],
qrySumOfSyndicationFeesDivisionHeadRE.[Line of Business],
qrySumOfSyndicationFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSyndicationFeesDivisionHeadRE.[Real Estate Market],
qrySumOfSyndicationFeesDivisionHeadRE.[Year], Null, Null, Null,Null
UNION SELECT qrySumOfOtherFeesDivisionHeadRE.[Customer Name],
qrySumOfOtherFeesDivisionHeadRE.[Relationship Manager],
qrySumOfOtherFeesDivisionHeadRE.[Line of Business],
qrySumOfOtherFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfOtherFeesDivisionHeadRE.[Real Estate Market],
qrySumOfOtherFeesDivisionHeadRE.[Year], Null AS DerivativeFees1, Null AS
AgencyFee2, Null AS IncrementalFeeIncome3,
Sum(qrySumOfOtherFeesDivisionHeadRE.[Grand Total]) AS GrandTotals4,Null AS
SubDebt5
FROM qrySumOfOtherFeesDivisionHeadRE
GROUP BY qrySumOfOtherFeesDivisionHeadRE.[Customer Name],
qrySumOfOtherFeesDivisionHeadRE.[Relationship Manager],
qrySumOfOtherFeesDivisionHeadRE.[Line of Business],
qrySumOfOtherFeesDivisionHeadRE.[Division Head Last Name Only],
qrySumOfOtherFeesDivisionHeadRE.[Real Estate Market],
qrySumOfOtherFeesDivisionHeadRE.[Year], Null, Null, Null,Null
UNION SELECT qrySumOfSubDebtRevenueDivisionHeadRE.[Customer Name],
qrySumOfSubDebtRevenueDivisionHeadRE.[Relationship Manager],
qrySumOfSubDebtRevenueDivisionHeadRE.[Line Of Business],
qrySumOfSubDebtRevenueDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSubDebtRevenueDivisionHeadRE.[Real Estate
Market],qrySumOfSubDebtRevenueDivisionHeadRE.[Year],Null AS DerivativeFees1,
Null AS AgencyFee2, Null AS IncrementalFeeIncome3, Null AS
GrandTotals4,Sum(qrySumOfSubDebtRevenueDivisionHeadRE.[SubDebt]) AS SubDebt5
FROM qrySumOfSubDebtRevenueDivisionHeadRE
GROUP BY qrySumOfSubDebtRevenueDivisionHeadRE.[Customer Name],
qrySumOfSubDebtRevenueDivisionHeadRE.[Relationship Manager],
qrySumOfSubDebtRevenueDivisionHeadRE.[Line Of Business],
qrySumOfSubDebtRevenueDivisionHeadRE.[Division Head Last Name Only],
qrySumOfSubDebtRevenueDivisionHeadRE.[Real Estate
Market],qrySumOfSubDebtRevenueDivisionHeadRE.[Year],Null, Null, Null,Null;