Union Queries

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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;

.



Relevant Pages

  • Re: Teachers being made liable for equipment.
    ... What type of school is this - it's not an Academy School by any chance? ... can be passed to the head before the note is reissued. ... The "Business Manager" must be salivating over that prospect! ...
    (uk.legal)
  • Re: OT: interesting global warming quote found elsewhwere
    ... I couldn't agree more about that whole MBA business. ... section) manager with an MBA whose previous job experience had been - I'm ... that production fell and the company just about tanked. ...
    (sci.electronics.design)
  • Re: OT: interesting global warming quote found elsewhwere
    ... I couldn't agree more about that whole MBA business. ... section) manager with an MBA whose previous job experience had been - I'm ... that production fell and the company just about tanked. ...
    (sci.electronics.design)
  • Re: OT: interesting global warming quote found elsewhwere
    ... I couldn't agree more about that whole MBA business. ... section) manager with an MBA whose previous job experience had been - I'm ... that production fell and the company just about tanked. ...
    (sci.electronics.design)
  • Re: What do you do?
    ... Yeah, since 1991, I made my living as a strip club DJ and manager. ... partner sold out his shares of the business to his partner. ... Never mind that he started his career in the business as I was ...
    (rec.arts.disney.parks)