Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8730443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:01:17+00:00 2026-06-13T09:01:17+00:00

How to split column values to raw values e.g: Col1 col2 1 james 1

  • 0

How to split column values to raw values e.g:

Col1            col2
1               james
1               gold
1               james@gmail.com
2               john
2               def
2               def@gmail.com

col1 values keep on changing to thousands.

results:

col1            col2      col3      col4
1               james     gold      james@gmail.com 
2               john      def       ef@gmail.com
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:01:17+00:00Added an answer on June 13, 2026 at 9:01 am

    try this:

    This will not guarantee the order of the values among the columns, as the table doesnt have a column to show the order of the columns..If you have a column, like that, you could change select 0 with that column

    with cte as(
    select *,ROW_NUMBER() 
             over(partition by Col1 order by (select 0))as rn from Table1)  
    select * from cte
    pivot(
       Max(COL2) FOR rn IN ([1],[2],[3] )  
       )P 
    

    SQL fiddle demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a csv file looks like this col1, col2, col3 1 , John,
I am trying to create a select query which will split a column values
I have a column 'name' in Database which has values as 'john,smith'. I'm passing
How do I split a single Excel column whose values are defined as such:
How do we use cross apply and split values in a column? I have
Possible Duplicate: Split string in SQL Searching a column with comma seperated values In
How can I return a identity column with a standard SQL CLR Split UDF
I have a dataframe with one column that I would like to split into
This is one column of a data frame. I want to further split into
Do MySQL have any function by which I can split data of a column

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.