SQL query to merge columns into single column in another table
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: SQL query to merge columns into single column in another table

  1. #1
    Join Date
    Jun 2009
    Posts
    1

    SQL query to merge columns into single column in another table

    HI EVERYBODY,

    please advise a query for the below,

    I have a table like this

    US UK India
    sales 100 50 55

    my updated table shld be like this

    sales US 100
    sales UK 50
    sales india 55

    please guide me...

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,027
    You can do the insert with a trigger, but to switch the columns to rows you need a pivot query.
    this space intentionally left blank

Posting Permissions

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


Click Here to Expand Forum to Full Width