Results 1 to 2 of 2

Thread: sql query

  1. #1
    Join Date
    Sep 2011
    Posts
    1

    sql query

    Hello, I have this table in Microsoft SQL.

    table

    ref Type Description

    aaa 1 rossi mario
    aaa 2 via Verdi 1
    aaa 3 20124 Milano
    bbb 1 bianchi nicola
    bbb 2 via Roma 4
    bbb 3 20100 Milano

    I need to use data in office compilation, so i wish to obtain an excel sheet with a sql query structured in this way:


    ref Description 1 Description 2 Description 3

    aaa rossi mario via Verdi 1 20124 Milano

    bbb bianchi nicola via Roma 4 20100 Milano

    How may I obtain this ?

    Thanks

    Stefano

  2. #2
    Join Date
    Sep 2002
    Posts
    5,938
    Which version of sql server you have? Take look at pivot operator in books online if you have sql2k5 or up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •