Count Problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following query set up - now i know that it is not a normalized
database but this is what I have to work with and hopefully I can get what I
need to work.

SELECT tblRR.ID, tblRR.Date, tblRR.RerouteContact, tblRR.ContactName,
tblRR.Name, tblRR.Address, tblRR.MCSNumber, tblRR.Acct1, tblRR.Acct2,
tblRR.Acct3, tblRR.Acct4, tblRR.Acct5, tblRR.Acct6, tblRR.Acct7, tblRR.Acct8,
tblRR.Acct9, tblRR.Acct10, tblRR.Acct11, tblRR.Acct12, tblRR.Acct13,
tblRR.Acct14, tblRR.Acct15, tblRR.Acct16, tblRR.Acct17, tblRR.Acct18,
tblRR.Acct19, tblRR.Acct20, tblRR.DateRecdBack, tblRR.FirstAttptFollowupDate,
tblRR.SecondAttptFollowupDate, tblRR.ThirdAttptFollowupDate,
tblRR.DaysOutOfCompliance,
Sum(-IsNull([Acct1])-IsNull([Acct2])-IsNull([Acct3])-IsNull([Acct4])-IsNull([Acct5])-IsNull([Acct6])-IsNull([Acct7])-IsNull([Acct8])-IsNull([Acct9])-IsNull([Acct10])-IsNull([Acct11])-IsNull([Acct12])-IsNull([Acct13])-IsNull([Acct14])-IsNull([Acct15])-IsNull([Acct16])-IsNull([Acct17])-IsNull([Acct18])-IsNull([Acct19])-IsNull([Acct20])) AS CountOfPieces
FROM tblRR;

When I try to run the query I am getting the following error message

"You tried to execute a query that does not include the specified expression
"ID" as part of an aggregate function"

Can someone please help me?
 
WMorsberger said:
"You tried to execute a query that does not include the specified expression
"ID" as part of an aggregate function"

You used an aggregate function, Sum, in the query so all other columns listed
must also be aggregate functions, or calculated columns, or else listed in
the GROUP BY clause.
i know that it is not a normalized
database but this is what I have to work with and hopefully I can get what I
need to work.

It takes *much* longer to "get things to work" in an unnormalized database
than it does just to normalize the tables. And even then that doesn't mean
"things work right."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top