The following crosstab query returns columns in this order:
Category | Total | Avg | Dec 08 | Jan 09 | Feb 09 | Mar 09 | Apr 09 | May 09
...however, if in query view, I manually move the Total and Avg columns as shown below,
then save the query, it will reopen in the modified format. There is no change to the SQL
so obviously something is going on behind the scenes.
NOTE: If I copy/paste the SQL to a new query, it opens in the format shown above.
Category | Dec 08 | Jan 09 | Feb 09 | Mar 09 | Apr 09 | May 09 | Total | Avg
Any ideas how a thing like this works and, if possible, link into it?
Your thoughts appreciated.
Bob
Category | Total | Avg | Dec 08 | Jan 09 | Feb 09 | Mar 09 | Apr 09 | May 09
...however, if in query view, I manually move the Total and Avg columns as shown below,
then save the query, it will reopen in the modified format. There is no change to the SQL
so obviously something is going on behind the scenes.
NOTE: If I copy/paste the SQL to a new query, it opens in the format shown above.
Category | Dec 08 | Jan 09 | Feb 09 | Mar 09 | Apr 09 | May 09 | Total | Avg
Any ideas how a thing like this works and, if possible, link into it?
Your thoughts appreciated.
Bob
Code:
TRANSFORM Format(nz(Sum([tblTransfer].[PayAmt]),0),"Currency") AS SumOfPayAmt
SELECT tblCat.Category, Sum(tblTransfer.PayAmt) AS Total, Format(Sum([tblTransfer].[PayAmt])/6,"$#.00") AS Avg
FROM tblTransfer LEFT JOIN tblCat ON tblTransfer.CatID = tblCat.CatID
WHERE (((CDate(Format([expdte],"mm/yyyy"))) Between #12/1/2008# And #5/31/2009#))
GROUP BY tblCat.Category
ORDER BY tblCat.Category, Format([expdte],"mmm yy")
PIVOT Format([expdte],"mmm yy") In ('Dec 08','Jan 09','Feb 09','Mar 09','Apr 09','May 09');
Last edited: