SQL Server Performance

Use of Pivot

Discussion in 'SQL Server 2005 General Developer Questions' started by jagblue, Oct 18, 2007.

  1. jagblue New Member

    Hi I wants to explore Pivot cluse SQL 2005
    I have a table
    tbl1(
    col 1 decimal,
    col 2 decimal,
    periodending datetime
    )
    O/P i wants in this format
    period1 period2 period3
    sum(col1) sum(col1) sum(col1)
    sum(col2) sum(col2) sum(col2)
    How can i achive this
    my I/P will be
    period1 = periodending between (date1) and (date2)
    period2 = periodending between (date3) and (date4)
    period3 = periodending > date(4)
    Thanks
  2. anandchatterjee New Member

    Implement through the case statement...
  3. Madhivanan Moderator

    Read about Cross-tab reports in sql server help file

Share This Page