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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT for each .... statement (Auto Columns)

Status
Not open for further replies.

SeaweedOPM

Technical User
Nov 19, 2004
53
0
0
US
This would be a simple report with Crystal Reports but I'm using web matrix.

I am using a datagrid to list employee errors. For a master summery page i really want all the employees listed vertically and for columns i want to list the error type. Then the actually contents will be the counts for each occurance.

This is the current statement that gets the data i want but i just need to auto generate columns for each Error in the z1_Error table. (It's because the errors are due to change and I can't get into the page and change them each time)

SELECT [z1_CSR].[CSR], [z1_Error].[Error], COUNT(z1_Issue.ErrorID) As ErrorID FROM [z1_CSR], [z1_Error], [z1_Issue] WHERE (([z1_CSR].[CSRID] = [z1_Issue].[CSRID]) AND ([z1_Error].[ErrorID] = [z1_Issue].[ErrorID])) Group By [z1_CSR].[CSR], [z1_Error].[Error]


The breakdown is:
[z1_CSR] 'Stores CSRID, CSR, Employeed (employee info)
[z1_Error] 'Stores ErrorID, Error, Discontinued (Table for errors)
[z1_Issue] 'Tracks each error; Stores IssueID, CSRID, ErrorID, Date

Finally a simple example:



Employees "Sold w/o ID" "No receipt" "Killed Cust"
Joe Blow 0 3 0
Jim Johnson 3 5 8
Totals 3 8 8



Excel works great but I need it imbeded in aspx page. Remember i'm using web matrix.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top