Monday, April 25, 2011

SQL query: put values of an attribute as columns

I have a table errors(errorId, category, eDate).

I am trying to show as result the number of errors per week and categories. The query result should be something like:

Week    Category1    Category2
01      2            5 
02      0            20
From stackoverflow
  • The code I posted wasn't right. You need to look into Crosstab Queries in Access.

  • Access can't do pivots, as far as I know. In SQL Server you could do this with the PIVOT() construct.

    Edit: Actually, take a look at this.

    HLGEM : LOL Access did crosstab queries long before SQL Server had pivot

0 comments:

Post a Comment