Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crosstab query calculations

Status
Not open for further replies.

jadams0173

Technical User
Feb 18, 2005
1,210
I'm trying to add a yeild column to my crosstab query however i'm struggling. This is my first crosstab query btw. Here is the SQL that makes up the crosstab.
Code:
PARAMETERS forms!frmMain!cboManager Text ( 255 );
SELECT del_defects.SFCNUMBER, del_defects.OPERATION, del_defects.DateTimeRC, del_defects.RCACCOUNT, del_test.COMPLETE_TSTAMP, IIf(IsNull([COMPLETE_TSTAMP]),'Fail','Pass') AS TEST, SNAPMAN_EMPLOYEE.DISPLAY_NAME, tblEmployeeInfo.MGR
FROM tblEmployeeInfo INNER JOIN (SNAPMAN_EMPLOYEE INNER JOIN (del_defects LEFT JOIN del_test ON (del_defects.SFCNUMBER = del_test.SFCNUMBER) AND (del_defects.DateTimeRC = del_test.MaxOfDateTimeRC)) ON SNAPMAN_EMPLOYEE.ACCOUNTID = del_defects.RCACCOUNT) ON tblEmployeeInfo.[Employee ID] = SNAPMAN_EMPLOYEE.ACCOUNTID
WHERE (((tblEmployeeInfo.MGR)=[forms]![frmMain]![cboManager]));

Here is the crosstab itself.

Code:
TRANSFORM nz(Count([del_Summary].[SFCNUMBER]),0) AS CountOfSFCNUMBER
SELECT del_Summary.RCACCOUNT, del_Summary.DISPLAY_NAME, Count(del_Summary.SFCNUMBER) AS Total, [red][Total]*2 AS Yeild[/red]
FROM del_Summary
GROUP BY del_Summary.RCACCOUNT, del_Summary.DISPLAY_NAME
ORDER BY del_Summary.DISPLAY_NAME
PIVOT del_Summary.TEST;

What I need to do is [Total]/[Pass] but the Column heading [PASS],is what the PIVOT is on. The crosstab returns that it doesn't recognize pass as a valid field or expression.

When ran the query looks like. I just put a value in the Yield so it would run.....

RCACCOUNT DISPLAY_NAME TOTAL YIELD FAIL PASS
12345 SOME NAME 10 20 5 5

Any ideas on how to do this???
 
I figured it out. The simple things are the hardest to see sometime. [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top