Table rows with identifying parameter in each row SQL SERVER 2008 into single row

Posted by LiverpoolsNumber9 on Stack Overflow See other posts from Stack Overflow or by LiverpoolsNumber9
Published on 2010-04-28T23:34:30Z Indexed on 2010/04/28 23:37 UTC
Read the original article Hit count: 278

Filed under:
|

Sorry - my question title is probably as inept at my attempt to do this.

I have the following (well, similar) in a table in a CMS

pageID    key            value    

201       title          Page 201's title
201       description    This is 201
201       author         Dave
301       title          Page 301's title
301       description    This is 301
301       author         Bob         

As you've probably guessed, what I need is a query that will produce:

pageID   title              description        author

201      Page 201's title   This is page 201   Dave
301      Page 301's title   This is page 301   Bob

If anybody could help, i'd be eternally grateful - I know this is "please send me the code" but I'm absolutely stuck.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about tsql