April15Hater
Accountant
- Local time
- Today, 18:20
- Joined
- Sep 12, 2008
- Messages
- 349
Hi,
I have two queries. qtrProduction [FunctionType, Status, ProductionUnits] and qxtProductionSummary. The qxt pulls info from the qtr. In my table I have the Production Units labeled as Aerial, Underground, and Unit. Aerial and Underground are footages and Unit is not. My problem is that I want to combine the Aerial and Underground to come up with a total footage column. So in my query, I attempt to combine the aerial and underground with
When I run the Query, it correctly has a footage and unit column with the respective information in the correct columns but for footage, it is showing a separate row for underground and for aerial where i would like the total. Any help is appreciated, and I pasted the entire query below.
I have two queries. qtrProduction [FunctionType, Status, ProductionUnits] and qxtProductionSummary. The qxt pulls info from the qtr. In my table I have the Production Units labeled as Aerial, Underground, and Unit. Aerial and Underground are footages and Unit is not. My problem is that I want to combine the Aerial and Underground to come up with a total footage column. So in my query, I attempt to combine the aerial and underground with
Code:
IIf([FunctionType]="Aerial" Or [FunctionType]="Underground","Footage",IIf([FunctionType]="Unit","Unit","")
When I run the Query, it correctly has a footage and unit column with the respective information in the correct columns but for footage, it is showing a separate row for underground and for aerial where i would like the total. Any help is appreciated, and I pasted the entire query below.
Code:
TRANSFORM Sum(qtrProduction.ProductionUnits) AS SumOfProductionUnits
SELECT [tblClient].[EndCustomer] & " (" & [tblClient].[ClientLocation] & ")" AS ClientName, tblJob.JobName, tblFunction.[Function Name], qtrProduction.Status, qtrProduction.FunctionID, tblFunction.[Function Name]
FROM (tblClient INNER JOIN tblJob ON tblClient.ClientID = tblJob.ClientID) INNER JOIN (qtrProduction INNER JOIN tblFunction ON qtrProduction.FunctionID = tblFunction.FunctionID) ON tblJob.JobID = tblFunction.JobID
WHERE (((qtrProduction.functiontype)="Aerial" Or (qtrProduction.functiontype)="Underground" Or (qtrProduction.functiontype)="Unit"))
GROUP BY tblClient.ClientID, [tblClient].[EndCustomer] & " (" & [tblClient].[ClientLocation] & ")", tblJob.JobName, tblFunction.[Function Name], qtrProduction.Status, qtrProduction.FunctionID, tblFunction.[Function Name], qtrProduction.functiontype
PIVOT IIf([FunctionType]="Aerial" Or [FunctionType]="Underground","Footage",IIf([FunctionType]="Unit","Unit",""));