[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

You tried to execute a query that does not include the specific expression as part of an aggregate function?????????

Posted on 2006-07-15
9
Medium Priority
?
329 Views
Last Modified: 2008-02-01
I am using the following cross-tab query but an error message comes out "You tried to execute a query that does not include the specific expression'TimeCode' as part of an aggregate function" any suggestions ? thanks !

TRANSFORM tbPlacement.TimeCode
SELECT tbStudentInfo.StudentName
FROM tbStudentInfo INNER JOIN (tbDetailsOfDates INNER JOIN (tbDetailsOfWeekday INNER JOIN (tbPlacement INNER JOIN tbStudentGroupList ON tbPlacement.GroupName = tbStudentGroupList.GroupName) ON tbDetailsOfWeekday.DayNo = tbPlacement.DayNo) ON (tbDetailsOfWeekday.DayNo = tbDetailsOfDates.DayNo) AND (tbDetailsOfDates.DayNo = tbPlacement.DayNo) AND (tbDetailsOfDates.WeekNo = tbPlacement.WeekNo) AND (tbDetailsOfDates.TermNo = tbPlacement.TermNo)) ON tbStudentInfo.StudentID = tbStudentGroupList.StudentID
WHERE (((tbPlacement.Venue)="4d") AND ((tbPlacement.VenueCode)="sh"))
GROUP BY tbStudentInfo.StudentName
ORDER BY tbStudentInfo.StudentName, tbDetailsOfDates.Dates
PIVOT tbDetailsOfDates.Dates;
0
Comment
Question by:mmccy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 65

Expert Comment

by:rockiroads
ID: 17115524
Does the TRANSFORM statement not require an aggregate function?

e,g,

TRANSFORM Sum(tbPlacement.TimeCode

or

TRANSFORM Var(tbPlacement.TimeCode
0
 

Author Comment

by:mmccy
ID: 17116552
there is no aggregate function for the transform statement
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17116652
What Im saying is, dont u need one
if u add one in, do u still get the error
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
LVL 44

Accepted Solution

by:
GRayL earned 1500 total points
ID: 17117674
By way of explanation, in a crosstab query, if the field in the TRANSFORM statement is not part of an Aggregate function, it must be named in the GROUP BY clause.  Normally, that field is wrapped in an aggregate function such as Sum, First, Last, Min, Max, etc. so the crosstab can serve as a collector of data, with rows as per the SELECT statement and additional columns as per the PIVOT clause.  It is hard to imagine a meaningful crosstab query without an aggregate function in the TRANSFORM statement.  When the TRANSFORM statement is an aggregate function, it is not part of the GROUP BY clause.  
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17117805
Perhaps thats how I needed to phrase it, as that was the point I was trying to make

mmccy, in your question after this, u used FIRST, just wondering whether what I wrote actually helped or not - feedback purposes
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17122865
Thanks, glad I could help.
0
 
LVL 44

Expert Comment

by:GRayL
ID: 17122866
Thanks, glad I could help.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17126869
GRayL appreciated it so much, it stressed it again :)
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17126870
urm, typo
should be

he stressed

not

it stressed

ooops
0

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question