views:

56

answers:

3

Hi,

    My table value is

    Esino  ym       workeddays  name
      1   200906        25        a 
      1   200907        24        a
      1   200908        27        a 
      2   200906         22       b
      2   200907        25....    b

I nedd out output is

     Esino   ym1     ym2    ym3      w1    w2   w3   name
      1      200906  200907 200908  25     24   27   a
      2      200906  200907  200908  22    25    21   b..

Condition is

  1. The ym is my input i given between month for dynamic for eg 200906 to 200912 or 200901 to 200906
  2. workeddays this also depend upon employee presents
+1  A: 

You can use pivoting - have a look at this question, very close to your scenario.

JohnIdol
A: 

Hi,

you can do this sort of thing using PIVOT

Veli
A: 

Solution is Dynamic Pivoting. Have a look Problem in dynamic pivoting + sql server 2005

priyanka.sarkar