Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / June 2007

Tip: Looking for answers? Try searching our database.

SQL Crosstab Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leslie W. - 21 Jun 2007 18:56 GMT
I have written the following SQL Statement:

TRANSFORM Sum(qryTSExportFY.Hours) AS SumOfHours
SELECT qryTSExportFY.ProjNum, qryTSExportFY.ProjSub1,
qryTSExportFY.ProjSub2, qryTSExportFY.LastName, Sum(qryTSExportFY.Hours) AS
TotalHours
FROM qryTSExportFY
GROUP BY qryTSExportFY.ProjNum, qryTSExportFY.ProjSub1,
qryTSExportFY.ProjSub2, qryTSExportFY.LastName
PIVOT qryTSExportFY.FiscalYear In ("FY05", "FY06", "July 2006", "August
2006", "September 2006", "October 2006", "November 2006", "December 2006",
"January 2007", "February 2007", "March 2007", "April 2007", "May 2007",
"June 2007");

My problem is that Access will create all of the columns, however, they are
not populated with the data from the pivot table.  A SumofHours Column was
created, but the hours do not distribute.  Any ideas where I went wrong?

Thanks for your help!
Dale Fye - 21 Jun 2007 19:14 GMT
In a crosstab query, you only get one set of aggregations, that is on the
field you select to use as a Value, and in your case shows up on the
TRANSFORM line of the query.  

1.  Delete the "Sum(qry_TSExportFY.Hours) AS TotalHours " portion of the
SELECT clause

2.  Do you really have all of the values "FY05", "FY06", "July 2006", ...
in your [FiscalYear] field?  I would think you would have a column for
FiscalYear (FY05, FY06, FY07, FY08) and another column for FiscalMonth.

HTH
Dale

Signature

Email address is not valid.
Please reply to newsgroup only.

> I have written the following SQL Statement:
>
[quoted text clipped - 15 lines]
>
> Thanks for your help!
Leslie W. - 21 Jun 2007 19:45 GMT
Dale,

I wanted to reference FY05 and FY06 in total for a summary only.  Your
comments put me on the right track, and I'm good to go now.  Thanks for your
help!

Leslie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.