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

Creating a crosstab in sql server 2000

Status
Not open for further replies.

Tigger9969

Programmer
Nov 27, 2001
7
CA
Can anyone help with create a query for sql 2000.

Here's a sample of what I'm trying to output.

employee Jan Feb Mar Apr May Jun Jul Aug Sep Nov Dec
emp1 sum of amount for each month
" "

then use crystal reports to sum each much, and calculate a acumulative sum.

The query looked like this in Access, but I'm having no luck in sql 2000.

TRANSFORM Sum(Entries.Downtime) AS [The Value]
SELECT Entries.OPID, Entries.Machine, Sum(Entries.Downtime) AS [Total Of Downtime]
FROM Entries
WHERE (((Entries.Machine)=[Forms]![fm_Report_selection]![machinetxt]) AND ((Entries.Date)<[forms]![fm_report_selection]![text55]))
GROUP BY Entries.OPID, Entries.Machine, Entries.Date
PIVOT Format([Date],&quot;mmm&quot;) In (&quot;Jan&quot;,&quot;Feb&quot;,&quot;Mar&quot;,&quot;Apr&quot;,&quot;May&quot;,&quot;Jun&quot;,&quot;Jul&quot;,&quot;Aug&quot;,&quot;Sep&quot;,&quot;Oct&quot;,&quot;Nov&quot;,&quot;Dec&quot;);

Any help would be appreciated.

Tigger9969
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top