Hi there,
A customer has asked me to create a report based on a cross-tab query. The data base schema is attached below.
The query must contain the following
ScrapCollection .regNum,
ScrapCollection .PTEtotal,
ScrapTireType.d escription (As the Pivot)
ScraptCollectio nTireType.amoun t (as a sum aggregate for each description)
This is the query I have at the moment
But it is wrong. I only want the data grouped by regNum. But Access will not let me do the following...
Any help will be greatly appreciated.
Thank you
A customer has asked me to create a report based on a cross-tab query. The data base schema is attached below.
The query must contain the following
ScrapCollection .regNum,
ScrapCollection .PTEtotal,
ScrapTireType.d escription (As the Pivot)
ScraptCollectio nTireType.amoun t (as a sum aggregate for each description)
This is the query I have at the moment
Code:
PARAMETERS [Forms]![AuditTotal]![start_Date] DateTime, [Forms]![AuditTotal]![end_Date] DateTime; TRANSFORM Sum(ScrapCollectionTireType.amount) AS SumOfamount SELECT ScrapCollection.regNum, ScrapCollection.PTEtotal FROM ScrapCollection INNER JOIN (ScrapTireType INNER JOIN ScrapCollectionTireType ON (ScrapTireType.scrapTireTypeID = ScrapCollectionTireType.scrapTireTypeID) AND (ScrapTireType.scrapTireTypeID = ScrapCollectionTireType.scrapTireTypeID)) ON ScrapCollection.scrapCollectionID = ScrapCollectionTireType.scrapCollectionID WHERE (((ScrapCollection.date2) Between [Forms]![AuditTotal]![start_Date] And [Forms]![AuditTotal]![end_Date])) GROUP BY ScrapCollection.regNum, ScrapCollection.PTEtotal PIVOT ScrapTireType.description;
Code:
PARAMETERS [Forms]![AuditTotal]![start_Date] DateTime, [Forms]![AuditTotal]![end_Date] DateTime; TRANSFORM Sum(ScrapCollectionTireType.amount) AS SumOfamount SELECT ScrapCollection.regNum, ScrapCollection.PTEtotal FROM ScrapCollection INNER JOIN (ScrapTireType INNER JOIN ScrapCollectionTireType ON (ScrapTireType.scrapTireTypeID = ScrapCollectionTireType.scrapTireTypeID) AND (ScrapTireType.scrapTireTypeID = ScrapCollectionTireType.scrapTireTypeID)) ON ScrapCollection.scrapCollectionID = ScrapCollectionTireType.scrapCollectionID WHERE (((ScrapCollection.date2) Between [Forms]![AuditTotal]![start_Date] And [Forms]![AuditTotal]![end_Date])) GROUP BY ScrapCollection.regNum PIVOT ScrapTireType.description;
Any help will be greatly appreciated.
Thank you
Comment