• What have you tried, and where are you getting stuck?

    Please read this

    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

    Look up Case statement, and

    group by Es

    Or the Pivot Functions